@toptal/picasso-form 6.2.2-alpha-MP-1619-form-warning-state-and-error-as-react-node-ea5bb78b6.7 → 6.2.2-alpha-HG-917-fix-overlapping-sidebar-295fb9c4b.9
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/dist-package/src/FormCompound/index.d.ts +0 -1
- package/dist-package/src/FormCompound/index.d.ts.map +1 -1
- package/dist-package/src/FormCompound/index.js +0 -2
- package/dist-package/src/FormCompound/index.js.map +1 -1
- package/dist-package/src/FormField/FormField.d.ts +2 -4
- package/dist-package/src/FormField/FormField.d.ts.map +1 -1
- package/dist-package/src/FormField/FormField.js +2 -4
- package/dist-package/src/FormField/FormField.js.map +1 -1
- package/package.json +15 -15
- package/src/FormCompound/index.ts +0 -2
- package/src/FormField/FormField.tsx +3 -13
- package/src/FormField/story/Error.example.tsx +0 -10
- package/src/FormField/story/index.jsx +0 -6
- package/dist-package/src/FormWarning/FormWarning.d.ts +0 -10
- package/dist-package/src/FormWarning/FormWarning.d.ts.map +0 -1
- package/dist-package/src/FormWarning/FormWarning.js +0 -22
- package/dist-package/src/FormWarning/FormWarning.js.map +0 -1
- package/dist-package/src/FormWarning/index.d.ts +0 -5
- package/dist-package/src/FormWarning/index.d.ts.map +0 -1
- package/dist-package/src/FormWarning/index.js +0 -2
- package/dist-package/src/FormWarning/index.js.map +0 -1
- package/src/FormField/story/ErrorAndWarning.example.tsx +0 -25
- package/src/FormField/story/Warning.example.tsx +0 -22
- package/src/FormWarning/FormWarning.tsx +0 -33
- package/src/FormWarning/__snapshots__/test.tsx.snap +0 -57
- package/src/FormWarning/index.ts +0 -6
- package/src/FormWarning/story/index.jsx +0 -9
- package/src/FormWarning/test.tsx +0 -34
|
@@ -4,6 +4,5 @@ export declare const FormCompound: import("react").ForwardRefExoticComponent<imp
|
|
|
4
4
|
Hint: import("react").ForwardRefExoticComponent<import("../FormHint/FormHint").Props & import("react").RefAttributes<HTMLDivElement>>;
|
|
5
5
|
Error: import("react").ForwardRefExoticComponent<import("../FormError/FormError").Props & import("react").RefAttributes<HTMLDivElement>>;
|
|
6
6
|
Label: import("react").ForwardRefExoticComponent<import("@toptal/picasso-form-label/dist-package/src/FormLabel/FormLabel").Props & import("react").RefAttributes<HTMLLabelElement>>;
|
|
7
|
-
Warning: import("react").ForwardRefExoticComponent<import("../FormWarning/FormWarning").Props & import("react").RefAttributes<HTMLDivElement>>;
|
|
8
7
|
};
|
|
9
8
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/FormCompound/index.ts"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/FormCompound/index.ts"],"names":[],"mappings":";AAOA,eAAO,MAAM,YAAY;;;;;CAKvB,CAAA"}
|
|
@@ -3,12 +3,10 @@ import { Form } from '../Form';
|
|
|
3
3
|
import { FormError } from '../FormError';
|
|
4
4
|
import { FormField } from '../FormField';
|
|
5
5
|
import { FormHint } from '../FormHint';
|
|
6
|
-
import { FormWarning } from '../FormWarning';
|
|
7
6
|
export const FormCompound = Object.assign(Form, {
|
|
8
7
|
Field: FormField,
|
|
9
8
|
Hint: FormHint,
|
|
10
9
|
Error: FormError,
|
|
11
10
|
Label: FormLabel,
|
|
12
|
-
Warning: FormWarning,
|
|
13
11
|
});
|
|
14
12
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/FormCompound/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,4BAA4B,CAAA;AAEtD,OAAO,EAAE,IAAI,EAAE,MAAM,SAAS,CAAA;AAC9B,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAA;AACxC,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAA;AACxC,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAA;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/FormCompound/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,4BAA4B,CAAA;AAEtD,OAAO,EAAE,IAAI,EAAE,MAAM,SAAS,CAAA;AAC9B,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAA;AACxC,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAA;AACxC,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAA;AAEtC,MAAM,CAAC,MAAM,YAAY,GAAG,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE;IAC9C,KAAK,EAAE,SAAS;IAChB,IAAI,EAAE,QAAQ;IACd,KAAK,EAAE,SAAS;IAChB,KAAK,EAAE,SAAS;CACjB,CAAC,CAAA"}
|
|
@@ -3,11 +3,9 @@ import React from 'react';
|
|
|
3
3
|
import type { BaseProps } from '@toptal/picasso-shared';
|
|
4
4
|
export interface Props extends BaseProps, HTMLAttributes<HTMLDivElement> {
|
|
5
5
|
/** The text of the hint */
|
|
6
|
-
hint?: string
|
|
6
|
+
hint?: string;
|
|
7
7
|
/** The text of the error */
|
|
8
|
-
error?: string
|
|
9
|
-
/** The text of the warning */
|
|
10
|
-
warning?: string | ReactNode;
|
|
8
|
+
error?: string;
|
|
11
9
|
/** The content of the Form.Field */
|
|
12
10
|
children: ReactNode;
|
|
13
11
|
/** Field requirements for this specific field */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FormField.d.ts","sourceRoot":"","sources":["../../../src/FormField/FormField.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"FormField.d.ts","sourceRoot":"","sources":["../../../src/FormField/FormField.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,cAAc,EAAE,MAAM,OAAO,CAAA;AACtD,OAAO,KAA+B,MAAM,OAAO,CAAA;AACnD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAA;AASvD,MAAM,WAAW,KAAM,SAAQ,SAAS,EAAE,cAAc,CAAC,cAAc,CAAC;IACtE,2BAA2B;IAC3B,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,4BAA4B;IAC5B,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,oCAAoC;IACpC,QAAQ,EAAE,SAAS,CAAA;IACnB,iDAAiD;IACjD,iBAAiB,CAAC,EAAE,SAAS,CAAA;IAC7B,kDAAkD;IAClD,iBAAiB,CAAC,EAAE,SAAS,CAAA;IAC7B,2CAA2C;IAC3C,mBAAmB,CAAC,EAAE,OAAO,CAAA;CAC9B;AA8CD,eAAO,MAAM,SAAS,8EAiDpB,CAAA;AAMF,eAAe,SAAS,CAAA"}
|
|
@@ -16,7 +16,6 @@ import { useFieldsLayoutContext } from '@toptal/picasso-form-layout';
|
|
|
16
16
|
import { FormHint } from '../FormHint';
|
|
17
17
|
import { FormError } from '../FormError';
|
|
18
18
|
import { createLabelWidthStyles, horizontalLayoutClasses } from './styles';
|
|
19
|
-
import { FormWarning } from '../FormWarning';
|
|
20
19
|
const FormFieldAdornments = ({ autoSaveIndicator, children, hasMultilineCounter, }) => {
|
|
21
20
|
const { layout } = useFieldsLayoutContext();
|
|
22
21
|
const isHorizontal = layout === 'horizontal';
|
|
@@ -31,7 +30,7 @@ const FormFieldAdornments = ({ autoSaveIndicator, children, hasMultilineCounter,
|
|
|
31
30
|
React.createElement(Container, { className: twJoin('absolute right-0', hasMultilineCounter ? '-top-[0.875rem]' : 'top-0') }, autoSaveIndicator)));
|
|
32
31
|
};
|
|
33
32
|
export const FormField = forwardRef(function FormField(props, ref) {
|
|
34
|
-
const { autoSaveIndicator, className, style, hint, children, error,
|
|
33
|
+
const { autoSaveIndicator, className, style, hint, children, error, fieldRequirements, hasMultilineCounter } = props, rest = __rest(props, ["autoSaveIndicator", "className", "style", "hint", "children", "error", "fieldRequirements", "hasMultilineCounter"]);
|
|
35
34
|
const { layout, labelWidth } = useFieldsLayoutContext();
|
|
36
35
|
const isHorizontal = layout === 'horizontal';
|
|
37
36
|
const labelWidthStyles = isHorizontal
|
|
@@ -41,8 +40,7 @@ export const FormField = forwardRef(function FormField(props, ref) {
|
|
|
41
40
|
children,
|
|
42
41
|
React.createElement(FormFieldAdornments, { autoSaveIndicator: autoSaveIndicator, hasMultilineCounter: hasMultilineCounter },
|
|
43
42
|
error && React.createElement(FormError, null, error),
|
|
44
|
-
|
|
45
|
-
hint && (React.createElement(FormHint, { className: twJoin((error || warning) && hint && 'mt-0') }, hint)),
|
|
43
|
+
hint && (React.createElement(FormHint, { className: twJoin(error && hint && 'mt-0') }, hint)),
|
|
46
44
|
fieldRequirements)));
|
|
47
45
|
});
|
|
48
46
|
FormField.defaultProps = {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FormField.js","sourceRoot":"","sources":["../../../src/FormField/FormField.tsx"],"names":[],"mappings":";;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"FormField.js","sourceRoot":"","sources":["../../../src/FormField/FormField.tsx"],"names":[],"mappings":";;;;;;;;;;;AACA,OAAO,KAAK,EAAE,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAA;AAEnD,OAAO,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAA;AACrD,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,gCAAgC,CAAA;AAChE,OAAO,EAAE,sBAAsB,EAAE,MAAM,6BAA6B,CAAA;AAEpE,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAA;AACtC,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAA;AACxC,OAAO,EAAE,sBAAsB,EAAE,uBAAuB,EAAE,MAAM,UAAU,CAAA;AAsB1E,MAAM,mBAAmB,GAAG,CAAC,EAC3B,iBAAiB,EACjB,QAAQ,EACR,mBAAmB,GACM,EAAE,EAAE;IAC7B,MAAM,EAAE,MAAM,EAAE,GAAG,sBAAsB,EAAE,CAAA;IAC3C,MAAM,YAAY,GAAG,MAAM,KAAK,YAAY,CAAA;IAE5C,IAAI,QAAQ,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,MAAM,KAAK,CAAC,EAAE;QAC3C,OAAO,IAAI,CAAA;KACZ;IAED,IAAI,CAAC,iBAAiB,EAAE;QACtB,OAAO,CACL,6BAAK,SAAS,EAAE,MAAM,CAAC,YAAY,IAAI,mBAAmB,CAAC,IACxD,QAAQ,CACL,CACP,CAAA;KACF;IAED,OAAO,CACL,oBAAC,SAAS,IACR,IAAI,QACJ,SAAS,EAAC,QAAQ,EAClB,SAAS,EAAE,MAAM,CAAC,eAAe,EAAE,YAAY,IAAI,mBAAmB,CAAC;QAEtE,QAAQ;QACT,oBAAC,SAAS,IACR,SAAS,EAAE,MAAM,CACf,kBAAkB,EAClB,mBAAmB,CAAC,CAAC,CAAC,iBAAiB,CAAC,CAAC,CAAC,OAAO,CAClD,IAEA,iBAAiB,CACR,CACF,CACb,CAAA;AACH,CAAC,CAAA;AAED,MAAM,CAAC,MAAM,SAAS,GAAG,UAAU,CAAwB,SAAS,SAAS,CAC3E,KAAK,EACL,GAAG;IAEH,MAAM,EACJ,iBAAiB,EACjB,SAAS,EACT,KAAK,EACL,IAAI,EACJ,QAAQ,EACR,KAAK,EACL,iBAAiB,EACjB,mBAAmB,KAEjB,KAAK,EADJ,IAAI,UACL,KAAK,EAVH,oHAUL,CAAQ,CAAA;IAET,MAAM,EAAE,MAAM,EAAE,UAAU,EAAE,GAAG,sBAAsB,EAAE,CAAA;IACvD,MAAM,YAAY,GAAG,MAAM,KAAK,YAAY,CAAA;IAC5C,MAAM,gBAAgB,GAAG,YAAY;QACnC,CAAC,CAAC,sBAAsB,CAAC,UAAU,CAAC;QACpC,CAAC,CAAC,EAAE,CAAA;IAEN,OAAO,CACL,6CACM,IAAI,IACR,GAAG,EAAE,GAAG,EACR,SAAS,EAAE,OAAO,CAChB,wBAAwB,EACxB,YAAY,IAAI,uBAAuB,EACvC,SAAS,CACV,EACD,KAAK,kCAAO,KAAK,GAAK,gBAAgB,2BAChB,OAAO,CAAC,KAAK,CAAC;QAEnC,QAAQ;QACT,oBAAC,mBAAmB,IAClB,iBAAiB,EAAE,iBAAiB,EACpC,mBAAmB,EAAE,mBAAmB;YAEvC,KAAK,IAAI,oBAAC,SAAS,QAAE,KAAK,CAAa;YACvC,IAAI,IAAI,CACP,oBAAC,QAAQ,IAAC,SAAS,EAAE,MAAM,CAAC,KAAK,IAAI,IAAI,IAAI,MAAM,CAAC,IACjD,IAAI,CACI,CACZ;YACA,iBAAiB,CACE,CAClB,CACP,CAAA;AACH,CAAC,CAAC,CAAA;AAEF,SAAS,CAAC,YAAY,GAAG,EAAE,CAAA;AAE3B,SAAS,CAAC,WAAW,GAAG,WAAW,CAAA;AAEnC,eAAe,SAAS,CAAA"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@toptal/picasso-form",
|
|
3
|
-
"version": "6.2.2-alpha-
|
|
3
|
+
"version": "6.2.2-alpha-HG-917-fix-overlapping-sidebar-295fb9c4b.9+295fb9c4b",
|
|
4
4
|
"description": "Toptal UI components library - Form",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
@@ -22,16 +22,16 @@
|
|
|
22
22
|
},
|
|
23
23
|
"homepage": "https://github.com/toptal/picasso/tree/master/packages/picasso#readme",
|
|
24
24
|
"dependencies": {
|
|
25
|
-
"@toptal/picasso-alert": "3.0.33-alpha-
|
|
26
|
-
"@toptal/picasso-collapse": "3.0.4-alpha-
|
|
27
|
-
"@toptal/picasso-container": "3.1.3-alpha-
|
|
28
|
-
"@toptal/picasso-form-label": "1.0.3-alpha-
|
|
29
|
-
"@toptal/picasso-form-layout": "1.0.3-alpha-
|
|
30
|
-
"@toptal/picasso-grid": "5.0.10-alpha-
|
|
31
|
-
"@toptal/picasso-icons": "1.12.2-alpha-
|
|
32
|
-
"@toptal/picasso-shared": "15.0.1-alpha-
|
|
33
|
-
"@toptal/picasso-typography": "4.0.4-alpha-
|
|
34
|
-
"@toptal/picasso-utils": "3.1.1-alpha-
|
|
25
|
+
"@toptal/picasso-alert": "3.0.33-alpha-HG-917-fix-overlapping-sidebar-295fb9c4b.9+295fb9c4b",
|
|
26
|
+
"@toptal/picasso-collapse": "3.0.4-alpha-HG-917-fix-overlapping-sidebar-295fb9c4b.9+295fb9c4b",
|
|
27
|
+
"@toptal/picasso-container": "3.1.3-alpha-HG-917-fix-overlapping-sidebar-295fb9c4b.9+295fb9c4b",
|
|
28
|
+
"@toptal/picasso-form-label": "1.0.3-alpha-HG-917-fix-overlapping-sidebar-295fb9c4b.9+295fb9c4b",
|
|
29
|
+
"@toptal/picasso-form-layout": "1.0.3-alpha-HG-917-fix-overlapping-sidebar-295fb9c4b.9+295fb9c4b",
|
|
30
|
+
"@toptal/picasso-grid": "5.0.10-alpha-HG-917-fix-overlapping-sidebar-295fb9c4b.9+295fb9c4b",
|
|
31
|
+
"@toptal/picasso-icons": "1.12.2-alpha-HG-917-fix-overlapping-sidebar-295fb9c4b.9+295fb9c4b",
|
|
32
|
+
"@toptal/picasso-shared": "15.0.1-alpha-HG-917-fix-overlapping-sidebar-295fb9c4b.355+295fb9c4b",
|
|
33
|
+
"@toptal/picasso-typography": "4.0.4-alpha-HG-917-fix-overlapping-sidebar-295fb9c4b.9+295fb9c4b",
|
|
34
|
+
"@toptal/picasso-utils": "3.1.1-alpha-HG-917-fix-overlapping-sidebar-295fb9c4b.9+295fb9c4b",
|
|
35
35
|
"ap-style-title-case": "^1.1.2",
|
|
36
36
|
"classnames": "^2.5.1",
|
|
37
37
|
"debounce": "^1.2.1"
|
|
@@ -51,14 +51,14 @@
|
|
|
51
51
|
".": "./dist-package/src/index.js"
|
|
52
52
|
},
|
|
53
53
|
"devDependencies": {
|
|
54
|
-
"@toptal/picasso-provider": "5.0.1-alpha-
|
|
55
|
-
"@toptal/picasso-tailwind-merge": "2.0.4-alpha-
|
|
56
|
-
"@toptal/picasso-test-utils": "1.1.2-alpha-
|
|
54
|
+
"@toptal/picasso-provider": "5.0.1-alpha-HG-917-fix-overlapping-sidebar-295fb9c4b.276+295fb9c4b",
|
|
55
|
+
"@toptal/picasso-tailwind-merge": "2.0.4-alpha-HG-917-fix-overlapping-sidebar-295fb9c4b.9+295fb9c4b",
|
|
56
|
+
"@toptal/picasso-test-utils": "1.1.2-alpha-HG-917-fix-overlapping-sidebar-295fb9c4b.355+295fb9c4b"
|
|
57
57
|
},
|
|
58
58
|
"files": [
|
|
59
59
|
"dist-package/**",
|
|
60
60
|
"!dist-package/tsconfig.tsbuildinfo",
|
|
61
61
|
"src"
|
|
62
62
|
],
|
|
63
|
-
"gitHead": "
|
|
63
|
+
"gitHead": "295fb9c4b3bc6f247af449aee17dd2d5ea56613a"
|
|
64
64
|
}
|
|
@@ -4,12 +4,10 @@ import { Form } from '../Form'
|
|
|
4
4
|
import { FormError } from '../FormError'
|
|
5
5
|
import { FormField } from '../FormField'
|
|
6
6
|
import { FormHint } from '../FormHint'
|
|
7
|
-
import { FormWarning } from '../FormWarning'
|
|
8
7
|
|
|
9
8
|
export const FormCompound = Object.assign(Form, {
|
|
10
9
|
Field: FormField,
|
|
11
10
|
Hint: FormHint,
|
|
12
11
|
Error: FormError,
|
|
13
12
|
Label: FormLabel,
|
|
14
|
-
Warning: FormWarning,
|
|
15
13
|
})
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
/* eslint-disable complexity */
|
|
2
1
|
import type { ReactNode, HTMLAttributes } from 'react'
|
|
3
2
|
import React, { forwardRef, Children } from 'react'
|
|
4
3
|
import type { BaseProps } from '@toptal/picasso-shared'
|
|
@@ -9,15 +8,12 @@ import { useFieldsLayoutContext } from '@toptal/picasso-form-layout'
|
|
|
9
8
|
import { FormHint } from '../FormHint'
|
|
10
9
|
import { FormError } from '../FormError'
|
|
11
10
|
import { createLabelWidthStyles, horizontalLayoutClasses } from './styles'
|
|
12
|
-
import { FormWarning } from '../FormWarning'
|
|
13
11
|
|
|
14
12
|
export interface Props extends BaseProps, HTMLAttributes<HTMLDivElement> {
|
|
15
13
|
/** The text of the hint */
|
|
16
|
-
hint?: string
|
|
14
|
+
hint?: string
|
|
17
15
|
/** The text of the error */
|
|
18
|
-
error?: string
|
|
19
|
-
/** The text of the warning */
|
|
20
|
-
warning?: string | ReactNode
|
|
16
|
+
error?: string
|
|
21
17
|
/** The content of the Form.Field */
|
|
22
18
|
children: ReactNode
|
|
23
19
|
/** Field requirements for this specific field */
|
|
@@ -83,7 +79,6 @@ export const FormField = forwardRef<HTMLDivElement, Props>(function FormField(
|
|
|
83
79
|
hint,
|
|
84
80
|
children,
|
|
85
81
|
error,
|
|
86
|
-
warning,
|
|
87
82
|
fieldRequirements,
|
|
88
83
|
hasMultilineCounter,
|
|
89
84
|
...rest
|
|
@@ -113,13 +108,8 @@ export const FormField = forwardRef<HTMLDivElement, Props>(function FormField(
|
|
|
113
108
|
hasMultilineCounter={hasMultilineCounter}
|
|
114
109
|
>
|
|
115
110
|
{error && <FormError>{error}</FormError>}
|
|
116
|
-
{warning && (
|
|
117
|
-
<FormWarning className={twJoin(error && hint && 'mt-0')}>
|
|
118
|
-
{warning}
|
|
119
|
-
</FormWarning>
|
|
120
|
-
)}
|
|
121
111
|
{hint && (
|
|
122
|
-
<FormHint className={twJoin(
|
|
112
|
+
<FormHint className={twJoin(error && hint && 'mt-0')}>
|
|
123
113
|
{hint}
|
|
124
114
|
</FormHint>
|
|
125
115
|
)}
|
|
@@ -14,16 +14,6 @@ const Example = () => (
|
|
|
14
14
|
placeholder='e.g., Sant Marti'
|
|
15
15
|
/>
|
|
16
16
|
</Form.Field>
|
|
17
|
-
|
|
18
|
-
<Form.Field error={<span>This field is required</span>}>
|
|
19
|
-
<Form.Label htmlFor='region'>Region</Form.Label>
|
|
20
|
-
<Input
|
|
21
|
-
status='error'
|
|
22
|
-
id='region'
|
|
23
|
-
width='full'
|
|
24
|
-
placeholder='e.g., Catalonia'
|
|
25
|
-
/>
|
|
26
|
-
</Form.Field>
|
|
27
17
|
</Form>
|
|
28
18
|
</Grid.Item>
|
|
29
19
|
</Grid>
|
|
@@ -12,12 +12,6 @@ const chapter = PicassoBook.connectToPage(page =>
|
|
|
12
12
|
.addExample('FormField/story/Default.example.tsx', 'Default', 'base/Form')
|
|
13
13
|
.addExample('FormField/story/Required.example.tsx', 'Required', 'base/Form')
|
|
14
14
|
.addExample('FormField/story/Error.example.tsx', 'Error', 'base/Form')
|
|
15
|
-
.addExample('FormField/story/Warning.example.tsx', 'Warning', 'base/Form')
|
|
16
|
-
.addExample(
|
|
17
|
-
'FormField/story/ErrorAndWarning.example.tsx',
|
|
18
|
-
'Error and Warning',
|
|
19
|
-
'base/Form'
|
|
20
|
-
)
|
|
21
15
|
.addExample('FormField/story/Hint.example.tsx', 'Hint', 'base/Form')
|
|
22
16
|
.addExample(
|
|
23
17
|
'FormField/story/HintAndError.example.tsx',
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import type { ReactNode, HTMLAttributes } from 'react';
|
|
2
|
-
import React from 'react';
|
|
3
|
-
import type { BaseProps } from '@toptal/picasso-shared';
|
|
4
|
-
export interface Props extends BaseProps, HTMLAttributes<HTMLDivElement> {
|
|
5
|
-
/** The text of the error */
|
|
6
|
-
children: ReactNode;
|
|
7
|
-
}
|
|
8
|
-
export declare const FormWarning: React.ForwardRefExoticComponent<Props & React.RefAttributes<HTMLDivElement>>;
|
|
9
|
-
export default FormWarning;
|
|
10
|
-
//# sourceMappingURL=FormWarning.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"FormWarning.d.ts","sourceRoot":"","sources":["../../../src/FormWarning/FormWarning.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,cAAc,EAAE,MAAM,OAAO,CAAA;AACtD,OAAO,KAAqB,MAAM,OAAO,CAAA;AACzC,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAA;AAIvD,MAAM,WAAW,KAAM,SAAQ,SAAS,EAAE,cAAc,CAAC,cAAc,CAAC;IACtE,4BAA4B;IAC5B,QAAQ,EAAE,SAAS,CAAA;CACpB;AAED,eAAO,MAAM,WAAW,8EAiBvB,CAAA;AAID,eAAe,WAAW,CAAA"}
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
var __rest = (this && this.__rest) || function (s, e) {
|
|
2
|
-
var t = {};
|
|
3
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
4
|
-
t[p] = s[p];
|
|
5
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
6
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
7
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
8
|
-
t[p[i]] = s[p[i]];
|
|
9
|
-
}
|
|
10
|
-
return t;
|
|
11
|
-
};
|
|
12
|
-
import React, { forwardRef } from 'react';
|
|
13
|
-
import { Typography } from '@toptal/picasso-typography';
|
|
14
|
-
import { twMerge } from '@toptal/picasso-tailwind-merge';
|
|
15
|
-
export const FormWarning = forwardRef(function FormWarning(props, ref) {
|
|
16
|
-
const { children, className, style } = props, rest = __rest(props, ["children", "className", "style"]);
|
|
17
|
-
return (React.createElement("div", Object.assign({}, rest, { ref: ref, className: twMerge('mt-1', className), style: style }),
|
|
18
|
-
React.createElement(Typography, { color: 'yellow', size: 'xxsmall', className: 'cursor-default' }, children)));
|
|
19
|
-
});
|
|
20
|
-
FormWarning.displayName = 'FormWarning';
|
|
21
|
-
export default FormWarning;
|
|
22
|
-
//# sourceMappingURL=FormWarning.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"FormWarning.js","sourceRoot":"","sources":["../../../src/FormWarning/FormWarning.tsx"],"names":[],"mappings":";;;;;;;;;;;AACA,OAAO,KAAK,EAAE,EAAE,UAAU,EAAE,MAAM,OAAO,CAAA;AAEzC,OAAO,EAAE,UAAU,EAAE,MAAM,4BAA4B,CAAA;AACvD,OAAO,EAAE,OAAO,EAAE,MAAM,gCAAgC,CAAA;AAOxD,MAAM,CAAC,MAAM,WAAW,GAAG,UAAU,CACnC,SAAS,WAAW,CAAC,KAAK,EAAE,GAAG;IAC7B,MAAM,EAAE,QAAQ,EAAE,SAAS,EAAE,KAAK,KAAc,KAAK,EAAd,IAAI,UAAK,KAAK,EAA/C,kCAAuC,CAAQ,CAAA;IAErD,OAAO,CACL,6CACM,IAAI,IACR,GAAG,EAAE,GAAG,EACR,SAAS,EAAE,OAAO,CAAC,MAAM,EAAE,SAAS,CAAC,EACrC,KAAK,EAAE,KAAK;QAEZ,oBAAC,UAAU,IAAC,KAAK,EAAC,QAAQ,EAAC,IAAI,EAAC,SAAS,EAAC,SAAS,EAAC,gBAAgB,IACjE,QAAQ,CACE,CACT,CACP,CAAA;AACH,CAAC,CACF,CAAA;AAED,WAAW,CAAC,WAAW,GAAG,aAAa,CAAA;AAEvC,eAAe,WAAW,CAAA"}
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import type { OmitInternalProps } from '@toptal/picasso-shared';
|
|
2
|
-
import type { Props } from './FormWarning';
|
|
3
|
-
export { default as FormWarning } from './FormWarning';
|
|
4
|
-
export declare type FormWarningProps = OmitInternalProps<Props>;
|
|
5
|
-
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/FormWarning/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAA;AAE/D,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,eAAe,CAAA;AAE1C,OAAO,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,eAAe,CAAA;AACtD,oBAAY,gBAAgB,GAAG,iBAAiB,CAAC,KAAK,CAAC,CAAA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/FormWarning/index.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,eAAe,CAAA"}
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import React from 'react'
|
|
2
|
-
import { Form, Input, Grid } from '@toptal/picasso'
|
|
3
|
-
|
|
4
|
-
const Example = () => (
|
|
5
|
-
<Grid>
|
|
6
|
-
<Grid.Item sm={5}>
|
|
7
|
-
<Form>
|
|
8
|
-
<Form.Field
|
|
9
|
-
error='This should not contain any special characters'
|
|
10
|
-
warning='This might be too long'
|
|
11
|
-
>
|
|
12
|
-
<Form.Label htmlFor='district'>District</Form.Label>
|
|
13
|
-
<Input
|
|
14
|
-
status='error'
|
|
15
|
-
id='district'
|
|
16
|
-
width='full'
|
|
17
|
-
placeholder='e.g., Sant Marti'
|
|
18
|
-
/>
|
|
19
|
-
</Form.Field>
|
|
20
|
-
</Form>
|
|
21
|
-
</Grid.Item>
|
|
22
|
-
</Grid>
|
|
23
|
-
)
|
|
24
|
-
|
|
25
|
-
export default Example
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import React from 'react'
|
|
2
|
-
import { Form, Input, Grid } from '@toptal/picasso'
|
|
3
|
-
|
|
4
|
-
const Example = () => (
|
|
5
|
-
<Grid>
|
|
6
|
-
<Grid.Item sm={5}>
|
|
7
|
-
<Form>
|
|
8
|
-
<Form.Field warning='This field is required'>
|
|
9
|
-
<Form.Label htmlFor='district'>District</Form.Label>
|
|
10
|
-
<Input
|
|
11
|
-
status='warning'
|
|
12
|
-
id='district'
|
|
13
|
-
width='full'
|
|
14
|
-
placeholder='e.g., Sant Marti'
|
|
15
|
-
/>
|
|
16
|
-
</Form.Field>
|
|
17
|
-
</Form>
|
|
18
|
-
</Grid.Item>
|
|
19
|
-
</Grid>
|
|
20
|
-
)
|
|
21
|
-
|
|
22
|
-
export default Example
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import type { ReactNode, HTMLAttributes } from 'react'
|
|
2
|
-
import React, { forwardRef } from 'react'
|
|
3
|
-
import type { BaseProps } from '@toptal/picasso-shared'
|
|
4
|
-
import { Typography } from '@toptal/picasso-typography'
|
|
5
|
-
import { twMerge } from '@toptal/picasso-tailwind-merge'
|
|
6
|
-
|
|
7
|
-
export interface Props extends BaseProps, HTMLAttributes<HTMLDivElement> {
|
|
8
|
-
/** The text of the error */
|
|
9
|
-
children: ReactNode
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
export const FormWarning = forwardRef<HTMLDivElement, Props>(
|
|
13
|
-
function FormWarning(props, ref) {
|
|
14
|
-
const { children, className, style, ...rest } = props
|
|
15
|
-
|
|
16
|
-
return (
|
|
17
|
-
<div
|
|
18
|
-
{...rest}
|
|
19
|
-
ref={ref}
|
|
20
|
-
className={twMerge('mt-1', className)}
|
|
21
|
-
style={style}
|
|
22
|
-
>
|
|
23
|
-
<Typography color='yellow' size='xxsmall' className='cursor-default'>
|
|
24
|
-
{children}
|
|
25
|
-
</Typography>
|
|
26
|
-
</div>
|
|
27
|
-
)
|
|
28
|
-
}
|
|
29
|
-
)
|
|
30
|
-
|
|
31
|
-
FormWarning.displayName = 'FormWarning'
|
|
32
|
-
|
|
33
|
-
export default FormWarning
|
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
|
-
|
|
3
|
-
exports[`FormWarning renders 1`] = `
|
|
4
|
-
<div>
|
|
5
|
-
<div
|
|
6
|
-
class="Picasso-root"
|
|
7
|
-
>
|
|
8
|
-
<form
|
|
9
|
-
class=""
|
|
10
|
-
>
|
|
11
|
-
<div
|
|
12
|
-
class="text-[1rem] [&+&]:mt-4"
|
|
13
|
-
data-field-has-error="false"
|
|
14
|
-
>
|
|
15
|
-
<label
|
|
16
|
-
class="block leading-[1em] mb-[0.5em] text-graphite"
|
|
17
|
-
>
|
|
18
|
-
<span
|
|
19
|
-
class="text-[0.875rem]"
|
|
20
|
-
>
|
|
21
|
-
Label:
|
|
22
|
-
</span>
|
|
23
|
-
</label>
|
|
24
|
-
<div
|
|
25
|
-
class="base-Input base-Input base-Input relative inline-flex gap-y gap-x items-center rounded-sm [font-size:_unset] group text-nowrap p-2 h-8 w-[18.75rem] bg-white after:content-[""] after:inline-block after:absolute after:top-0 after:bottom-0 after:right-0 after:left-0 after:pointer-events after:border-solid after:rounded-sm after:border-gray [&:has(:focus)]:after:border-blue after:border [&:has(:focus)]:after:shadow-[0_0_0_3px] [&:has(:focus)]:after:shadow-blue hover:[&:not(:has(:focus))]:after:border-gray text-black cursor-[inherit]"
|
|
26
|
-
>
|
|
27
|
-
<input
|
|
28
|
-
aria-invalid="false"
|
|
29
|
-
autocomplete="none"
|
|
30
|
-
class="base-Input [&::-webkit-calendar-picker-indicator]:bg bg-transparent border-none box-border cursor-[inherit] h-full outline-none p-0 peer resize-none w-full text-md leading-4 text-black [&::placeholder]:text-gray [&::placeholder]:opacity-100"
|
|
31
|
-
type="text"
|
|
32
|
-
value=""
|
|
33
|
-
/>
|
|
34
|
-
</div>
|
|
35
|
-
<div
|
|
36
|
-
class="mt-1"
|
|
37
|
-
>
|
|
38
|
-
<p
|
|
39
|
-
class="m-0 text-2xs text-yellow font-regular cursor-default"
|
|
40
|
-
>
|
|
41
|
-
My Warning
|
|
42
|
-
</p>
|
|
43
|
-
</div>
|
|
44
|
-
<div
|
|
45
|
-
class="mt-1"
|
|
46
|
-
>
|
|
47
|
-
<p
|
|
48
|
-
class="m-0 text-2xs text-graphite font-regular"
|
|
49
|
-
>
|
|
50
|
-
This is a hint
|
|
51
|
-
</p>
|
|
52
|
-
</div>
|
|
53
|
-
</div>
|
|
54
|
-
</form>
|
|
55
|
-
</div>
|
|
56
|
-
</div>
|
|
57
|
-
`;
|
package/src/FormWarning/index.ts
DELETED
package/src/FormWarning/test.tsx
DELETED
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import React from 'react'
|
|
2
|
-
import type { RenderResult } from '@toptal/picasso-test-utils'
|
|
3
|
-
import { render } from '@toptal/picasso-test-utils'
|
|
4
|
-
import type { OmitInternalProps } from '@toptal/picasso-shared'
|
|
5
|
-
import { Input } from '@toptal/picasso-input'
|
|
6
|
-
|
|
7
|
-
import type { Props } from './FormWarning'
|
|
8
|
-
import { FormCompound as Form } from '../FormCompound'
|
|
9
|
-
|
|
10
|
-
const TestFormError = ({ children }: OmitInternalProps<Props>) => {
|
|
11
|
-
return (
|
|
12
|
-
<Form>
|
|
13
|
-
<Form.Field>
|
|
14
|
-
<Form.Label>Label:</Form.Label>
|
|
15
|
-
<Input />
|
|
16
|
-
<Form.Warning>{children}</Form.Warning>
|
|
17
|
-
<Form.Hint>This is a hint</Form.Hint>
|
|
18
|
-
</Form.Field>
|
|
19
|
-
</Form>
|
|
20
|
-
)
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
describe('FormWarning', () => {
|
|
24
|
-
let api: RenderResult
|
|
25
|
-
|
|
26
|
-
beforeEach(() => {
|
|
27
|
-
api = render(<TestFormError>My Warning</TestFormError>)
|
|
28
|
-
})
|
|
29
|
-
it('renders', () => {
|
|
30
|
-
const { container } = api
|
|
31
|
-
|
|
32
|
-
expect(container).toMatchSnapshot()
|
|
33
|
-
})
|
|
34
|
-
})
|