@toptal/picasso-form 6.1.9-alpha-ff-x-replace-overflow-hidden-by-clip-popper-4c9b94a3e.1 → 6.2.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/dist-package/src/Form/Form.d.ts +1 -1
- package/dist-package/src/Form/Form.d.ts.map +1 -1
- package/dist-package/src/Form/Form.js +1 -1
- package/dist-package/src/Form/Form.js.map +1 -1
- package/dist-package/src/FormActionsContainer/FormActionsContainer.js +1 -1
- package/dist-package/src/FormActionsContainer/FormActionsContainer.js.map +1 -1
- package/dist-package/src/FormCompound/index.d.ts +1 -1
- package/dist-package/src/FormCompound/index.d.ts.map +1 -1
- package/dist-package/src/FormCompound/index.js +1 -1
- package/dist-package/src/FormCompound/index.js.map +1 -1
- package/dist-package/src/FormField/FormField.js +1 -1
- package/dist-package/src/FormField/FormField.js.map +1 -1
- package/dist-package/src/FormField/styles.d.ts +1 -1
- package/dist-package/src/FormField/styles.d.ts.map +1 -1
- package/dist-package/src/FormField/styles.js +1 -1
- package/dist-package/src/FormField/styles.js.map +1 -1
- package/dist-package/src/FormLevelError/FormLevelError.d.ts +9 -0
- package/dist-package/src/FormLevelError/FormLevelError.d.ts.map +1 -0
- package/dist-package/src/FormLevelError/FormLevelError.js +23 -0
- package/dist-package/src/FormLevelError/FormLevelError.js.map +1 -0
- package/dist-package/src/FormLevelError/index.d.ts +2 -0
- package/dist-package/src/FormLevelError/index.d.ts.map +1 -0
- package/dist-package/src/FormLevelError/index.js +2 -0
- package/dist-package/src/FormLevelError/index.js.map +1 -0
- package/dist-package/src/FormLevelWarning/FormLevelWarning.d.ts +9 -0
- package/dist-package/src/FormLevelWarning/FormLevelWarning.d.ts.map +1 -0
- package/dist-package/src/FormLevelWarning/FormLevelWarning.js +23 -0
- package/dist-package/src/FormLevelWarning/FormLevelWarning.js.map +1 -0
- package/dist-package/src/FormLevelWarning/index.d.ts +2 -0
- package/dist-package/src/FormLevelWarning/index.d.ts.map +1 -0
- package/dist-package/src/FormLevelWarning/index.js +2 -0
- package/dist-package/src/FormLevelWarning/index.js.map +1 -0
- package/dist-package/src/index.d.ts +4 -3
- package/dist-package/src/index.d.ts.map +1 -1
- package/dist-package/src/index.js +3 -3
- package/dist-package/src/index.js.map +1 -1
- package/package.json +15 -13
- package/src/Form/Form.tsx +2 -3
- package/src/Form/story/Error.example.tsx +50 -0
- package/src/Form/story/Warning.example.tsx +50 -0
- package/src/Form/story/index.jsx +18 -1
- package/src/FormActionsContainer/FormActionsContainer.tsx +1 -1
- package/src/FormCompound/index.ts +2 -1
- package/src/FormField/FormField.tsx +1 -1
- package/src/FormField/styles.ts +2 -3
- package/src/FormField/test.tsx +4 -4
- package/src/FormLevelError/FormLevelError.tsx +31 -0
- package/src/FormLevelError/index.ts +1 -0
- package/src/FormLevelWarning/FormLevelWarning.tsx +31 -0
- package/src/FormLevelWarning/index.ts +1 -0
- package/src/index.ts +14 -3
- package/LICENSE +0 -20
- package/dist-package/src/FieldsLayout/FieldsLayoutContext.d.ts +0 -20
- package/dist-package/src/FieldsLayout/FieldsLayoutContext.d.ts.map +0 -1
- package/dist-package/src/FieldsLayout/FieldsLayoutContext.js +0 -17
- package/dist-package/src/FieldsLayout/FieldsLayoutContext.js.map +0 -1
- package/dist-package/src/FieldsLayout/index.d.ts +0 -2
- package/dist-package/src/FieldsLayout/index.d.ts.map +0 -1
- package/dist-package/src/FieldsLayout/index.js +0 -2
- package/dist-package/src/FieldsLayout/index.js.map +0 -1
- package/dist-package/src/FormControlLabel/FormControlLabel.d.ts +0 -23
- package/dist-package/src/FormControlLabel/FormControlLabel.d.ts.map +0 -1
- package/dist-package/src/FormControlLabel/FormControlLabel.js +0 -26
- package/dist-package/src/FormControlLabel/FormControlLabel.js.map +0 -1
- package/dist-package/src/FormControlLabel/index.d.ts +0 -5
- package/dist-package/src/FormControlLabel/index.d.ts.map +0 -1
- package/dist-package/src/FormControlLabel/index.js +0 -2
- package/dist-package/src/FormControlLabel/index.js.map +0 -1
- package/dist-package/src/FormLabel/FormLabel.d.ts +0 -30
- package/dist-package/src/FormLabel/FormLabel.d.ts.map +0 -1
- package/dist-package/src/FormLabel/FormLabel.js +0 -37
- package/dist-package/src/FormLabel/FormLabel.js.map +0 -1
- package/dist-package/src/FormLabel/index.d.ts +0 -6
- package/dist-package/src/FormLabel/index.d.ts.map +0 -1
- package/dist-package/src/FormLabel/index.js +0 -2
- package/dist-package/src/FormLabel/index.js.map +0 -1
- package/dist-package/src/FormLabel/styles.d.ts +0 -12
- package/dist-package/src/FormLabel/styles.d.ts.map +0 -1
- package/dist-package/src/FormLabel/styles.js +0 -24
- package/dist-package/src/FormLabel/styles.js.map +0 -1
- package/src/FieldsLayout/FieldsLayoutContext.tsx +0 -53
- package/src/FieldsLayout/index.ts +0 -1
- package/src/FormControlLabel/FormControlLabel.tsx +0 -84
- package/src/FormControlLabel/index.ts +0 -6
- package/src/FormLabel/FormLabel.tsx +0 -106
- package/src/FormLabel/__snapshots__/test.tsx.snap +0 -146
- package/src/FormLabel/index.ts +0 -7
- package/src/FormLabel/story/index.jsx +0 -6
- package/src/FormLabel/styles.ts +0 -66
- package/src/FormLabel/test.tsx +0 -111
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { FormEventHandler, ReactNode, FormHTMLAttributes } from 'react';
|
|
2
2
|
import React from 'react';
|
|
3
3
|
import type { BaseProps } from '@toptal/picasso-shared';
|
|
4
|
-
import type { LabelColumnSize, ResponsiveLabelColumnSize } from '
|
|
4
|
+
import type { LabelColumnSize, ResponsiveLabelColumnSize } from '@toptal/picasso-form-layout';
|
|
5
5
|
export interface Props extends BaseProps, FormHTMLAttributes<HTMLFormElement> {
|
|
6
6
|
/** Content of Form constructed of Form elements */
|
|
7
7
|
children?: ReactNode;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Form.d.ts","sourceRoot":"","sources":["../../../src/Form/Form.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,SAAS,EAAE,kBAAkB,EAAE,MAAM,OAAO,CAAA;AAC5E,OAAO,KAAqB,MAAM,OAAO,CAAA;AACzC,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAA;
|
|
1
|
+
{"version":3,"file":"Form.d.ts","sourceRoot":"","sources":["../../../src/Form/Form.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,SAAS,EAAE,kBAAkB,EAAE,MAAM,OAAO,CAAA;AAC5E,OAAO,KAAqB,MAAM,OAAO,CAAA;AACzC,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAA;AAGvD,OAAO,KAAK,EACV,eAAe,EACf,yBAAyB,EAC1B,MAAM,6BAA6B,CAAA;AAEpC,MAAM,WAAW,KAAM,SAAQ,SAAS,EAAE,kBAAkB,CAAC,eAAe,CAAC;IAC3E,mDAAmD;IACnD,QAAQ,CAAC,EAAE,SAAS,CAAA;IACpB,qBAAqB;IACrB,QAAQ,CAAC,EAAE,gBAAgB,CAAC,eAAe,CAAC,CAAA;IAC5C,kBAAkB;IAClB,MAAM,CAAC,EAAE,YAAY,GAAG,UAAU,CAAA;IAClC,kBAAkB;IAClB,UAAU,CAAC,EAAE,eAAe,GAAG,yBAAyB,CAAA;CACzD;AAED,eAAO,MAAM,IAAI,+EAiBf,CAAA;AAIF,eAAe,IAAI,CAAA"}
|
|
@@ -11,7 +11,7 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
11
11
|
};
|
|
12
12
|
import React, { forwardRef } from 'react';
|
|
13
13
|
import cx from 'classnames';
|
|
14
|
-
import { FieldsLayoutContextProvider } from '
|
|
14
|
+
import { FieldsLayoutContextProvider } from '@toptal/picasso-form-layout';
|
|
15
15
|
export const Form = forwardRef(function Form(_a, ref) {
|
|
16
16
|
var { onSubmit, className, style, children, layout, labelWidth } = _a, rest = __rest(_a, ["onSubmit", "className", "style", "children", "layout", "labelWidth"]);
|
|
17
17
|
return (React.createElement("form", Object.assign({}, rest, { ref: ref, onSubmit: onSubmit, className: cx(className), style: style }),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Form.js","sourceRoot":"","sources":["../../../src/Form/Form.tsx"],"names":[],"mappings":";;;;;;;;;;;AACA,OAAO,KAAK,EAAE,EAAE,UAAU,EAAE,MAAM,OAAO,CAAA;AAEzC,OAAO,EAAE,MAAM,YAAY,CAAA;
|
|
1
|
+
{"version":3,"file":"Form.js","sourceRoot":"","sources":["../../../src/Form/Form.tsx"],"names":[],"mappings":";;;;;;;;;;;AACA,OAAO,KAAK,EAAE,EAAE,UAAU,EAAE,MAAM,OAAO,CAAA;AAEzC,OAAO,EAAE,MAAM,YAAY,CAAA;AAC3B,OAAO,EAAE,2BAA2B,EAAE,MAAM,6BAA6B,CAAA;AAiBzE,MAAM,CAAC,MAAM,IAAI,GAAG,UAAU,CAAyB,SAAS,IAAI,CAClE,EAAqE,EACrE,GAAG;QADH,EAAE,QAAQ,EAAE,SAAS,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAM,EAAE,UAAU,OAAW,EAAN,IAAI,cAAnE,sEAAqE,CAAF;IAGnE,OAAO,CACL,8CACM,IAAI,IACR,GAAG,EAAE,GAAG,EACR,QAAQ,EAAE,QAAQ,EAClB,SAAS,EAAE,EAAE,CAAC,SAAS,CAAC,EACxB,KAAK,EAAE,KAAK;QAEZ,oBAAC,2BAA2B,IAAC,MAAM,EAAE,MAAM,EAAE,UAAU,EAAE,UAAU,IAChE,QAAQ,CACmB,CACzB,CACR,CAAA;AACH,CAAC,CAAC,CAAA;AAEF,IAAI,CAAC,WAAW,GAAG,MAAM,CAAA;AAEzB,eAAe,IAAI,CAAA"}
|
|
@@ -11,7 +11,7 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
11
11
|
};
|
|
12
12
|
import React from 'react';
|
|
13
13
|
import { Container } from '@toptal/picasso-container';
|
|
14
|
-
import { useFieldsLayoutContext } from '
|
|
14
|
+
import { useFieldsLayoutContext } from '@toptal/picasso-form-layout';
|
|
15
15
|
import { createLabelWidthStyles, horizontalLayoutClasses, } from '../FormField/styles';
|
|
16
16
|
const FormActionsContainer = (_a) => {
|
|
17
17
|
var { children, style } = _a, rest = __rest(_a, ["children", "style"]);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FormActionsContainer.js","sourceRoot":"","sources":["../../../src/FormActionsContainer/FormActionsContainer.tsx"],"names":[],"mappings":";;;;;;;;;;;AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AAGzB,OAAO,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAA;
|
|
1
|
+
{"version":3,"file":"FormActionsContainer.js","sourceRoot":"","sources":["../../../src/FormActionsContainer/FormActionsContainer.tsx"],"names":[],"mappings":";;;;;;;;;;;AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AAGzB,OAAO,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAA;AACrD,OAAO,EAAE,sBAAsB,EAAE,MAAM,6BAA6B,CAAA;AAEpE,OAAO,EACL,sBAAsB,EACtB,uBAAuB,GACxB,MAAM,qBAAqB,CAAA;AAO5B,MAAM,oBAAoB,GAAG,CAAC,EAAmC,EAAE,EAAE;QAAvC,EAAE,QAAQ,EAAE,KAAK,OAAkB,EAAb,IAAI,cAA1B,qBAA4B,CAAF;IACtD,MAAM,EAAE,MAAM,EAAE,UAAU,EAAE,GAAG,sBAAsB,EAAE,CAAA;IAEvD,IAAI,MAAM,KAAK,UAAU,EAAE;QACzB,OAAO,oBAAC,SAAS,oBAAK,IAAI,GAAG,QAAQ,CAAa,CAAA;KACnD;IAED,MAAM,gBAAgB,GAAG,sBAAsB,CAAC,UAAU,CAAC,CAAA;IAE3D,OAAO,CACL,oBAAC,SAAS,kBACR,SAAS,EAAE,uBAAuB,IAC9B,IAAI,IACR,KAAK,kCAAO,KAAK,GAAK,gBAAgB;QAEtC,gCAAO;QACP,iCAAM,QAAQ,CAAO,CACX,CACb,CAAA;AACH,CAAC,CAAA;AAED,eAAe,oBAAoB,CAAA"}
|
|
@@ -3,6 +3,6 @@ export declare const FormCompound: import("react").ForwardRefExoticComponent<imp
|
|
|
3
3
|
Field: import("react").ForwardRefExoticComponent<import("../FormField/FormField").Props & import("react").RefAttributes<HTMLDivElement>>;
|
|
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
|
-
Label: import("react").ForwardRefExoticComponent<import("
|
|
6
|
+
Label: import("react").ForwardRefExoticComponent<import("@toptal/picasso-form-label/dist-package/src/FormLabel/FormLabel").Props & import("react").RefAttributes<HTMLLabelElement>>;
|
|
7
7
|
};
|
|
8
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"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
+
import { FormLabel } from '@toptal/picasso-form-label';
|
|
1
2
|
import { Form } from '../Form';
|
|
2
3
|
import { FormError } from '../FormError';
|
|
3
4
|
import { FormField } from '../FormField';
|
|
4
5
|
import { FormHint } from '../FormHint';
|
|
5
|
-
import { FormLabel } from '../FormLabel';
|
|
6
6
|
export const FormCompound = Object.assign(Form, {
|
|
7
7
|
Field: FormField,
|
|
8
8
|
Hint: FormHint,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/FormCompound/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,
|
|
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"}
|
|
@@ -12,10 +12,10 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
12
12
|
import React, { forwardRef, Children } from 'react';
|
|
13
13
|
import { Container } from '@toptal/picasso-container';
|
|
14
14
|
import { twJoin, twMerge } from '@toptal/picasso-tailwind-merge';
|
|
15
|
+
import { useFieldsLayoutContext } from '@toptal/picasso-form-layout';
|
|
15
16
|
import { FormHint } from '../FormHint';
|
|
16
17
|
import { FormError } from '../FormError';
|
|
17
18
|
import { createLabelWidthStyles, horizontalLayoutClasses } from './styles';
|
|
18
|
-
import { useFieldsLayoutContext } from '../FieldsLayout';
|
|
19
19
|
const FormFieldAdornments = ({ autoSaveIndicator, children, hasMultilineCounter, }) => {
|
|
20
20
|
const { layout } = useFieldsLayoutContext();
|
|
21
21
|
const isHorizontal = layout === 'horizontal';
|
|
@@ -1 +1 @@
|
|
|
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;
|
|
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"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { BreakpointKeys } from '@toptal/picasso-provider';
|
|
2
|
-
import type { LabelColumnSize, ResponsiveLabelColumnSize } from '
|
|
2
|
+
import type { LabelColumnSize, ResponsiveLabelColumnSize } from '@toptal/picasso-form-layout';
|
|
3
3
|
export declare const getLabelWithName: (breakpoint: BreakpointKeys) => string;
|
|
4
4
|
export declare const FORM_LABEL_WIDTH_CSS_VARIABLE = "--form-label-width";
|
|
5
5
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"styles.d.ts","sourceRoot":"","sources":["../../../src/FormField/styles.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAA;
|
|
1
|
+
{"version":3,"file":"styles.d.ts","sourceRoot":"","sources":["../../../src/FormField/styles.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAA;AAE9D,OAAO,KAAK,EACV,eAAe,EACf,yBAAyB,EAC1B,MAAM,6BAA6B,CAAA;AAEpC,eAAO,MAAM,gBAAgB,eAAgB,cAAc,WAE1D,CAAA;AAED,eAAO,MAAM,6BAA6B,uBAAuB,CAAA;AAQjE;;GAEG;AACH,eAAO,MAAM,sBAAsB,eACrB,eAAe,GAAG,yBAAyB,KACtD,OAAO,MAAM,EAAE,eAAe,GAAG,cAAc,CAsBjD,CAAA;AAED,eAAO,MAAM,uBAAuB,4cAUjC,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"styles.js","sourceRoot":"","sources":["../../../src/FormField/styles.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"styles.js","sourceRoot":"","sources":["../../../src/FormField/styles.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,wBAAwB,EAAE,MAAM,6BAA6B,CAAA;AAMtE,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,UAA0B,EAAE,EAAE;IAC7D,OAAO,uBAAuB,UAAU,EAAE,CAAA;AAC5C,CAAC,CAAA;AAED,MAAM,CAAC,MAAM,6BAA6B,GAAG,oBAAoB,CAAA;AAEjE,MAAM,iBAAiB,GAAG,CACxB,UAAuD,EACxB,EAAE;IACjC,OAAO,OAAO,UAAU,KAAK,QAAQ,CAAA;AACvC,CAAC,CAAA;AAED;;GAEG;AACH,MAAM,CAAC,MAAM,sBAAsB,GAAG,CACpC,UAAuD,EACL,EAAE;IACpD,IAAI,iBAAiB,CAAC,UAAU,CAAC,EAAE;QACjC,OAAO,EAAE,CAAC,6BAA6B,CAAC,EAAE,UAAU,EAAE,CAAA;KACvD;IAED,IAAI,qBAAqB,GAAoB,wBAAwB,CAAA;IACrE,MAAM,WAAW,GAAG,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,CAAqB,CAAA;IAE1D,OAAO,WAAW,CAAC,MAAM,CACvB,CAAC,GAAG,EAAE,UAAU,EAAE,EAAE;;QAClB,IAAI,UAAU,CAAC,UAAU,CAAC,KAAK,SAAS,EAAE;YACxC,qBAAqB,GAAG,UAAU,CAAC,UAAU,CAAE,CAAA;SAChD;QAED,uCACK,GAAG,KACN,CAAC,gBAAgB,CAAC,UAAU,CAAC,CAAC,EAC5B,MAAA,UAAU,CAAC,UAAU,CAAC,mCAAI,qBAAqB,IAClD;IACH,CAAC,EACD,EAAE,CACH,CAAA;AACH,CAAC,CAAA;AAED,MAAM,CAAC,MAAM,uBAAuB,GAAG;;;;;;;;;;GAUpC,CAAA"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { ReactNode, HTMLAttributes } from 'react';
|
|
3
|
+
import type { BaseProps } from '@toptal/picasso-shared';
|
|
4
|
+
export interface Props extends BaseProps, HTMLAttributes<HTMLDivElement> {
|
|
5
|
+
children: ReactNode;
|
|
6
|
+
}
|
|
7
|
+
export declare const FormLevelError: React.ForwardRefExoticComponent<Props & React.RefAttributes<HTMLDivElement>>;
|
|
8
|
+
export default FormLevelError;
|
|
9
|
+
//# sourceMappingURL=FormLevelError.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FormLevelError.d.ts","sourceRoot":"","sources":["../../../src/FormLevelError/FormLevelError.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAqB,MAAM,OAAO,CAAA;AACzC,OAAO,KAAK,EAAE,SAAS,EAAE,cAAc,EAAE,MAAM,OAAO,CAAA;AACtD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAA;AAKvD,MAAM,WAAW,KAAM,SAAQ,SAAS,EAAE,cAAc,CAAC,cAAc,CAAC;IACtE,QAAQ,EAAE,SAAS,CAAA;CACpB;AAED,eAAO,MAAM,cAAc,8EAe1B,CAAA;AAID,eAAe,cAAc,CAAA"}
|
|
@@ -0,0 +1,23 @@
|
|
|
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 { Alert } from '@toptal/picasso-alert';
|
|
14
|
+
import { Container } from '@toptal/picasso-container';
|
|
15
|
+
import { twMerge } from '@toptal/picasso-tailwind-merge';
|
|
16
|
+
export const FormLevelError = forwardRef(function FormLevelError(props, ref) {
|
|
17
|
+
const { children, className, style } = props, rest = __rest(props, ["children", "className", "style"]);
|
|
18
|
+
return (React.createElement(Container, Object.assign({}, rest, { ref: ref, className: twMerge('mb-4', className), style: style }),
|
|
19
|
+
React.createElement(Alert, { variant: 'red' }, children)));
|
|
20
|
+
});
|
|
21
|
+
FormLevelError.displayName = 'FormLevelError';
|
|
22
|
+
export default FormLevelError;
|
|
23
|
+
//# sourceMappingURL=FormLevelError.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FormLevelError.js","sourceRoot":"","sources":["../../../src/FormLevelError/FormLevelError.tsx"],"names":[],"mappings":";;;;;;;;;;;AAAA,OAAO,KAAK,EAAE,EAAE,UAAU,EAAE,MAAM,OAAO,CAAA;AAGzC,OAAO,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAA;AAC7C,OAAO,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAA;AACrD,OAAO,EAAE,OAAO,EAAE,MAAM,gCAAgC,CAAA;AAMxD,MAAM,CAAC,MAAM,cAAc,GAAG,UAAU,CACtC,SAAS,cAAc,CAAC,KAAK,EAAE,GAAG;IAChC,MAAM,EAAE,QAAQ,EAAE,SAAS,EAAE,KAAK,KAAc,KAAK,EAAd,IAAI,UAAK,KAAK,EAA/C,kCAAuC,CAAQ,CAAA;IAErD,OAAO,CACL,oBAAC,SAAS,oBACJ,IAAI,IACR,GAAG,EAAE,GAAG,EACR,SAAS,EAAE,OAAO,CAAC,MAAM,EAAE,SAAS,CAAC,EACrC,KAAK,EAAE,KAAK;QAEZ,oBAAC,KAAK,IAAC,OAAO,EAAC,KAAK,IAAE,QAAQ,CAAS,CAC7B,CACb,CAAA;AACH,CAAC,CACF,CAAA;AAED,cAAc,CAAC,WAAW,GAAG,gBAAgB,CAAA;AAE7C,eAAe,cAAc,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/FormLevelError/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/FormLevelError/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAA"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { ReactNode, HTMLAttributes } from 'react';
|
|
3
|
+
import type { BaseProps } from '@toptal/picasso-shared';
|
|
4
|
+
export interface Props extends BaseProps, HTMLAttributes<HTMLDivElement> {
|
|
5
|
+
children: ReactNode;
|
|
6
|
+
}
|
|
7
|
+
export declare const FormLevelWarning: React.ForwardRefExoticComponent<Props & React.RefAttributes<HTMLDivElement>>;
|
|
8
|
+
export default FormLevelWarning;
|
|
9
|
+
//# sourceMappingURL=FormLevelWarning.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FormLevelWarning.d.ts","sourceRoot":"","sources":["../../../src/FormLevelWarning/FormLevelWarning.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAqB,MAAM,OAAO,CAAA;AACzC,OAAO,KAAK,EAAE,SAAS,EAAE,cAAc,EAAE,MAAM,OAAO,CAAA;AACtD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAA;AAKvD,MAAM,WAAW,KAAM,SAAQ,SAAS,EAAE,cAAc,CAAC,cAAc,CAAC;IACtE,QAAQ,EAAE,SAAS,CAAA;CACpB;AAED,eAAO,MAAM,gBAAgB,8EAe5B,CAAA;AAID,eAAe,gBAAgB,CAAA"}
|
|
@@ -0,0 +1,23 @@
|
|
|
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 { Alert } from '@toptal/picasso-alert';
|
|
14
|
+
import { Container } from '@toptal/picasso-container';
|
|
15
|
+
import { twMerge } from '@toptal/picasso-tailwind-merge';
|
|
16
|
+
export const FormLevelWarning = forwardRef(function FormLevelWarning(props, ref) {
|
|
17
|
+
const { children, className, style } = props, rest = __rest(props, ["children", "className", "style"]);
|
|
18
|
+
return (React.createElement(Container, Object.assign({}, rest, { ref: ref, className: twMerge('mt-4', className), style: style }),
|
|
19
|
+
React.createElement(Alert, { variant: 'yellow' }, children)));
|
|
20
|
+
});
|
|
21
|
+
FormLevelWarning.displayName = 'FormLevelWarning';
|
|
22
|
+
export default FormLevelWarning;
|
|
23
|
+
//# sourceMappingURL=FormLevelWarning.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FormLevelWarning.js","sourceRoot":"","sources":["../../../src/FormLevelWarning/FormLevelWarning.tsx"],"names":[],"mappings":";;;;;;;;;;;AAAA,OAAO,KAAK,EAAE,EAAE,UAAU,EAAE,MAAM,OAAO,CAAA;AAGzC,OAAO,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAA;AAC7C,OAAO,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAA;AACrD,OAAO,EAAE,OAAO,EAAE,MAAM,gCAAgC,CAAA;AAMxD,MAAM,CAAC,MAAM,gBAAgB,GAAG,UAAU,CACxC,SAAS,gBAAgB,CAAC,KAAK,EAAE,GAAG;IAClC,MAAM,EAAE,QAAQ,EAAE,SAAS,EAAE,KAAK,KAAc,KAAK,EAAd,IAAI,UAAK,KAAK,EAA/C,kCAAuC,CAAQ,CAAA;IAErD,OAAO,CACL,oBAAC,SAAS,oBACJ,IAAI,IACR,GAAG,EAAE,GAAG,EACR,SAAS,EAAE,OAAO,CAAC,MAAM,EAAE,SAAS,CAAC,EACrC,KAAK,EAAE,KAAK;QAEZ,oBAAC,KAAK,IAAC,OAAO,EAAC,QAAQ,IAAE,QAAQ,CAAS,CAChC,CACb,CAAA;AACH,CAAC,CACF,CAAA;AAED,gBAAgB,CAAC,WAAW,GAAG,kBAAkB,CAAA;AAEjD,eAAe,gBAAgB,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/FormLevelWarning/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/FormLevelWarning/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAA"}
|
|
@@ -3,10 +3,11 @@ export * from './Form';
|
|
|
3
3
|
export * from './FormError';
|
|
4
4
|
export * from './FormHint';
|
|
5
5
|
export * from './FormField';
|
|
6
|
-
export
|
|
7
|
-
export
|
|
8
|
-
export * from './FieldsLayout';
|
|
6
|
+
export type { FieldsLayoutContextProviderProps, FieldsLayoutContextValue, FieldLayout, LabelColumnSize, ResponsiveLabelColumnSize, } from '@toptal/picasso-form-layout';
|
|
7
|
+
export { useFieldsLayoutContext, FieldsLayoutContextProvider, } from '@toptal/picasso-form-layout';
|
|
9
8
|
export * from './FormAutoSaveIndicator';
|
|
10
9
|
export * from './FieldRequirements';
|
|
11
10
|
export * from './FormActionsContainer';
|
|
11
|
+
export { default as FormLevelError } from './FormLevelError';
|
|
12
|
+
export { default as FormLevelWarning } from './FormLevelWarning';
|
|
12
13
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAA;AAC9B,cAAc,QAAQ,CAAA;AACtB,cAAc,aAAa,CAAA;AAC3B,cAAc,YAAY,CAAA;AAC1B,cAAc,aAAa,CAAA;AAC3B,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAA;AAC9B,cAAc,QAAQ,CAAA;AACtB,cAAc,aAAa,CAAA;AAC3B,cAAc,YAAY,CAAA;AAC1B,cAAc,aAAa,CAAA;AAC3B,YAAY,EACV,gCAAgC,EAChC,wBAAwB,EACxB,WAAW,EACX,eAAe,EACf,yBAAyB,GAC1B,MAAM,6BAA6B,CAAA;AACpC,OAAO,EACL,sBAAsB,EACtB,2BAA2B,GAC5B,MAAM,6BAA6B,CAAA;AAEpC,cAAc,yBAAyB,CAAA;AACvC,cAAc,qBAAqB,CAAA;AACnC,cAAc,wBAAwB,CAAA;AACtC,OAAO,EAAE,OAAO,IAAI,cAAc,EAAE,MAAM,kBAAkB,CAAA;AAC5D,OAAO,EAAE,OAAO,IAAI,gBAAgB,EAAE,MAAM,oBAAoB,CAAA"}
|
|
@@ -3,10 +3,10 @@ export * from './Form';
|
|
|
3
3
|
export * from './FormError';
|
|
4
4
|
export * from './FormHint';
|
|
5
5
|
export * from './FormField';
|
|
6
|
-
export
|
|
7
|
-
export * from './FormLabel';
|
|
8
|
-
export * from './FieldsLayout';
|
|
6
|
+
export { useFieldsLayoutContext, FieldsLayoutContextProvider, } from '@toptal/picasso-form-layout';
|
|
9
7
|
export * from './FormAutoSaveIndicator';
|
|
10
8
|
export * from './FieldRequirements';
|
|
11
9
|
export * from './FormActionsContainer';
|
|
10
|
+
export { default as FormLevelError } from './FormLevelError';
|
|
11
|
+
export { default as FormLevelWarning } from './FormLevelWarning';
|
|
12
12
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAA;AAC9B,cAAc,QAAQ,CAAA;AACtB,cAAc,aAAa,CAAA;AAC3B,cAAc,YAAY,CAAA;AAC1B,cAAc,aAAa,CAAA;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAA;AAC9B,cAAc,QAAQ,CAAA;AACtB,cAAc,aAAa,CAAA;AAC3B,cAAc,YAAY,CAAA;AAC1B,cAAc,aAAa,CAAA;AAQ3B,OAAO,EACL,sBAAsB,EACtB,2BAA2B,GAC5B,MAAM,6BAA6B,CAAA;AAEpC,cAAc,yBAAyB,CAAA;AACvC,cAAc,qBAAqB,CAAA;AACnC,cAAc,wBAAwB,CAAA;AACtC,OAAO,EAAE,OAAO,IAAI,cAAc,EAAE,MAAM,kBAAkB,CAAA;AAC5D,OAAO,EAAE,OAAO,IAAI,gBAAgB,EAAE,MAAM,oBAAoB,CAAA"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@toptal/picasso-form",
|
|
3
|
-
"version": "6.
|
|
3
|
+
"version": "6.2.0",
|
|
4
4
|
"description": "Toptal UI components library - Form",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
@@ -22,13 +22,16 @@
|
|
|
22
22
|
},
|
|
23
23
|
"homepage": "https://github.com/toptal/picasso/tree/master/packages/picasso#readme",
|
|
24
24
|
"dependencies": {
|
|
25
|
-
"@toptal/picasso-
|
|
26
|
-
"@toptal/picasso-
|
|
27
|
-
"@toptal/picasso-
|
|
28
|
-
"@toptal/picasso-
|
|
29
|
-
"@toptal/picasso-
|
|
30
|
-
"@toptal/picasso-
|
|
31
|
-
"@toptal/picasso-
|
|
25
|
+
"@toptal/picasso-alert": "3.0.31",
|
|
26
|
+
"@toptal/picasso-collapse": "3.0.2",
|
|
27
|
+
"@toptal/picasso-container": "3.1.1",
|
|
28
|
+
"@toptal/picasso-grid": "5.0.8",
|
|
29
|
+
"@toptal/picasso-icons": "1.12.0",
|
|
30
|
+
"@toptal/picasso-form-label": "1.0.1",
|
|
31
|
+
"@toptal/picasso-form-layout": "1.0.1",
|
|
32
|
+
"@toptal/picasso-shared": "15.0.0",
|
|
33
|
+
"@toptal/picasso-typography": "4.0.2",
|
|
34
|
+
"@toptal/picasso-utils": "3.0.0",
|
|
32
35
|
"ap-style-title-case": "^1.1.2",
|
|
33
36
|
"classnames": "^2.5.1",
|
|
34
37
|
"debounce": "^1.2.1"
|
|
@@ -48,14 +51,13 @@
|
|
|
48
51
|
".": "./dist-package/src/index.js"
|
|
49
52
|
},
|
|
50
53
|
"devDependencies": {
|
|
51
|
-
"@toptal/picasso-
|
|
52
|
-
"@toptal/picasso-
|
|
53
|
-
"@toptal/picasso-test-utils": "1.1.
|
|
54
|
+
"@toptal/picasso-tailwind-merge": "2.0.2",
|
|
55
|
+
"@toptal/picasso-provider": "5.0.0",
|
|
56
|
+
"@toptal/picasso-test-utils": "1.1.1"
|
|
54
57
|
},
|
|
55
58
|
"files": [
|
|
56
59
|
"dist-package/**",
|
|
57
60
|
"!dist-package/tsconfig.tsbuildinfo",
|
|
58
61
|
"src"
|
|
59
|
-
]
|
|
60
|
-
"gitHead": "4c9b94a3e62c29b2bef0b9e028e358948269df7c"
|
|
62
|
+
]
|
|
61
63
|
}
|
package/src/Form/Form.tsx
CHANGED
|
@@ -2,12 +2,11 @@ import type { FormEventHandler, ReactNode, FormHTMLAttributes } from 'react'
|
|
|
2
2
|
import React, { forwardRef } from 'react'
|
|
3
3
|
import type { BaseProps } from '@toptal/picasso-shared'
|
|
4
4
|
import cx from 'classnames'
|
|
5
|
-
|
|
6
|
-
import { FieldsLayoutContextProvider } from '../FieldsLayout'
|
|
5
|
+
import { FieldsLayoutContextProvider } from '@toptal/picasso-form-layout'
|
|
7
6
|
import type {
|
|
8
7
|
LabelColumnSize,
|
|
9
8
|
ResponsiveLabelColumnSize,
|
|
10
|
-
} from '
|
|
9
|
+
} from '@toptal/picasso-form-layout'
|
|
11
10
|
|
|
12
11
|
export interface Props extends BaseProps, FormHTMLAttributes<HTMLFormElement> {
|
|
13
12
|
/** Content of Form constructed of Form elements */
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import {
|
|
3
|
+
Button,
|
|
4
|
+
Container,
|
|
5
|
+
Form,
|
|
6
|
+
Input,
|
|
7
|
+
FormLevelError,
|
|
8
|
+
Grid,
|
|
9
|
+
} from '@toptal/picasso'
|
|
10
|
+
|
|
11
|
+
const Example = () => {
|
|
12
|
+
return (
|
|
13
|
+
<Grid>
|
|
14
|
+
<Grid.Item sm={5}>
|
|
15
|
+
<Form>
|
|
16
|
+
<FormLevelError>Please correct the errors in the form</FormLevelError>
|
|
17
|
+
|
|
18
|
+
<Form.Field>
|
|
19
|
+
<Form.Label>Username</Form.Label>
|
|
20
|
+
<Input
|
|
21
|
+
required
|
|
22
|
+
value=''
|
|
23
|
+
placeholder='Enter your username'
|
|
24
|
+
width='full'
|
|
25
|
+
/>
|
|
26
|
+
</Form.Field>
|
|
27
|
+
|
|
28
|
+
<Form.Field>
|
|
29
|
+
<Form.Label>Email</Form.Label>
|
|
30
|
+
<Input
|
|
31
|
+
required
|
|
32
|
+
value=''
|
|
33
|
+
placeholder='Enter your email'
|
|
34
|
+
type='email'
|
|
35
|
+
width='full'
|
|
36
|
+
/>
|
|
37
|
+
</Form.Field>
|
|
38
|
+
|
|
39
|
+
<Container flex justifyContent='flex-end' className='mt-4'>
|
|
40
|
+
<Button type='submit' variant='primary'>
|
|
41
|
+
Submit
|
|
42
|
+
</Button>
|
|
43
|
+
</Container>
|
|
44
|
+
</Form>
|
|
45
|
+
</Grid.Item>
|
|
46
|
+
</Grid>
|
|
47
|
+
)
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
export default Example
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import {
|
|
3
|
+
Button,
|
|
4
|
+
Container,
|
|
5
|
+
Form,
|
|
6
|
+
FormLevelWarning,
|
|
7
|
+
Input,
|
|
8
|
+
Grid,
|
|
9
|
+
} from '@toptal/picasso'
|
|
10
|
+
|
|
11
|
+
const Example = () => {
|
|
12
|
+
return (
|
|
13
|
+
<Grid>
|
|
14
|
+
<Grid.Item sm={5}>
|
|
15
|
+
<Form>
|
|
16
|
+
<Form.Field>
|
|
17
|
+
<Form.Label>Username</Form.Label>
|
|
18
|
+
<Input
|
|
19
|
+
value='johndoe'
|
|
20
|
+
placeholder='Enter your username'
|
|
21
|
+
width='full'
|
|
22
|
+
/>
|
|
23
|
+
</Form.Field>
|
|
24
|
+
|
|
25
|
+
<Form.Field>
|
|
26
|
+
<Form.Label>Email</Form.Label>
|
|
27
|
+
<Input
|
|
28
|
+
value='johndoe@example.com'
|
|
29
|
+
placeholder='Enter your email'
|
|
30
|
+
type='email'
|
|
31
|
+
width='full'
|
|
32
|
+
/>
|
|
33
|
+
</Form.Field>
|
|
34
|
+
|
|
35
|
+
<FormLevelWarning>
|
|
36
|
+
Please review the information before submitting
|
|
37
|
+
</FormLevelWarning>
|
|
38
|
+
|
|
39
|
+
<Container flex justifyContent='flex-end' className='mt-4'>
|
|
40
|
+
<Button type='submit' variant='primary'>
|
|
41
|
+
Submit
|
|
42
|
+
</Button>
|
|
43
|
+
</Container>
|
|
44
|
+
</Form>
|
|
45
|
+
</Grid.Item>
|
|
46
|
+
</Grid>
|
|
47
|
+
)
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
export default Example
|
package/src/Form/story/index.jsx
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
|
+
import formLabelStory from '@toptal/picasso-form-label/src/FormLabel/story'
|
|
2
|
+
|
|
1
3
|
import { Form } from '../Form'
|
|
2
4
|
import formFieldStory from '../../FormField/story'
|
|
3
5
|
import formHintStory from '../../FormHint/story'
|
|
4
|
-
import formLabelStory from '../../FormLabel/story'
|
|
5
6
|
import formErrorStory from '../../FormError/story'
|
|
6
7
|
import PicassoBook from '~/.storybook/components/PicassoBook'
|
|
7
8
|
|
|
@@ -25,4 +26,20 @@ page
|
|
|
25
26
|
.addComponentDocs(formLabelStory.componentDocs)
|
|
26
27
|
.addComponentDocs(formErrorStory.componentDocs)
|
|
27
28
|
|
|
29
|
+
page.createChapter().addExample(
|
|
30
|
+
'Form/story/Error.example.tsx',
|
|
31
|
+
{
|
|
32
|
+
title: 'Form-Level Error',
|
|
33
|
+
},
|
|
34
|
+
'base/Form'
|
|
35
|
+
)
|
|
36
|
+
|
|
37
|
+
page.createChapter().addExample(
|
|
38
|
+
'Form/story/Warning.example.tsx',
|
|
39
|
+
{
|
|
40
|
+
title: 'Form-Level Warning',
|
|
41
|
+
},
|
|
42
|
+
'base/Form'
|
|
43
|
+
)
|
|
44
|
+
|
|
28
45
|
page.connect(formFieldStory.chapter)
|
|
@@ -2,8 +2,8 @@ import React from 'react'
|
|
|
2
2
|
import type { ReactNode } from 'react'
|
|
3
3
|
import type { ContainerProps } from '@toptal/picasso-container'
|
|
4
4
|
import { Container } from '@toptal/picasso-container'
|
|
5
|
+
import { useFieldsLayoutContext } from '@toptal/picasso-form-layout'
|
|
5
6
|
|
|
6
|
-
import { useFieldsLayoutContext } from '../FieldsLayout'
|
|
7
7
|
import {
|
|
8
8
|
createLabelWidthStyles,
|
|
9
9
|
horizontalLayoutClasses,
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
+
import { FormLabel } from '@toptal/picasso-form-label'
|
|
2
|
+
|
|
1
3
|
import { Form } from '../Form'
|
|
2
4
|
import { FormError } from '../FormError'
|
|
3
5
|
import { FormField } from '../FormField'
|
|
4
6
|
import { FormHint } from '../FormHint'
|
|
5
|
-
import { FormLabel } from '../FormLabel'
|
|
6
7
|
|
|
7
8
|
export const FormCompound = Object.assign(Form, {
|
|
8
9
|
Field: FormField,
|
|
@@ -3,11 +3,11 @@ import React, { forwardRef, Children } from 'react'
|
|
|
3
3
|
import type { BaseProps } from '@toptal/picasso-shared'
|
|
4
4
|
import { Container } from '@toptal/picasso-container'
|
|
5
5
|
import { twJoin, twMerge } from '@toptal/picasso-tailwind-merge'
|
|
6
|
+
import { useFieldsLayoutContext } from '@toptal/picasso-form-layout'
|
|
6
7
|
|
|
7
8
|
import { FormHint } from '../FormHint'
|
|
8
9
|
import { FormError } from '../FormError'
|
|
9
10
|
import { createLabelWidthStyles, horizontalLayoutClasses } from './styles'
|
|
10
|
-
import { useFieldsLayoutContext } from '../FieldsLayout'
|
|
11
11
|
|
|
12
12
|
export interface Props extends BaseProps, HTMLAttributes<HTMLDivElement> {
|
|
13
13
|
/** The text of the hint */
|
package/src/FormField/styles.ts
CHANGED
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import type { BreakpointKeys } from '@toptal/picasso-provider'
|
|
2
|
-
|
|
3
|
-
import { DEFAULT_LABEL_WIDTH_SIZE } from '../FieldsLayout'
|
|
2
|
+
import { DEFAULT_LABEL_WIDTH_SIZE } from '@toptal/picasso-form-layout'
|
|
4
3
|
import type {
|
|
5
4
|
LabelColumnSize,
|
|
6
5
|
ResponsiveLabelColumnSize,
|
|
7
|
-
} from '
|
|
6
|
+
} from '@toptal/picasso-form-layout'
|
|
8
7
|
|
|
9
8
|
export const getLabelWithName = (breakpoint: BreakpointKeys) => {
|
|
10
9
|
return `--form-label-width--${breakpoint}`
|
package/src/FormField/test.tsx
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import React from 'react'
|
|
2
2
|
import { render } from '@toptal/picasso-test-utils'
|
|
3
|
-
|
|
4
|
-
import { FormField } from './index'
|
|
5
|
-
import { FieldsLayoutContextProvider } from '../FieldsLayout'
|
|
3
|
+
import { FieldsLayoutContextProvider } from '@toptal/picasso-form-layout'
|
|
6
4
|
import type {
|
|
7
5
|
LabelColumnSize,
|
|
8
6
|
ResponsiveLabelColumnSize,
|
|
9
|
-
} from '
|
|
7
|
+
} from '@toptal/picasso-form-layout'
|
|
8
|
+
|
|
9
|
+
import { FormField } from './index'
|
|
10
10
|
|
|
11
11
|
const renderFormField = (
|
|
12
12
|
layout: 'horizontal' | 'vertical' = 'vertical',
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import React, { forwardRef } from 'react'
|
|
2
|
+
import type { ReactNode, HTMLAttributes } from 'react'
|
|
3
|
+
import type { BaseProps } from '@toptal/picasso-shared'
|
|
4
|
+
import { Alert } from '@toptal/picasso-alert'
|
|
5
|
+
import { Container } from '@toptal/picasso-container'
|
|
6
|
+
import { twMerge } from '@toptal/picasso-tailwind-merge'
|
|
7
|
+
|
|
8
|
+
export interface Props extends BaseProps, HTMLAttributes<HTMLDivElement> {
|
|
9
|
+
children: ReactNode
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export const FormLevelError = forwardRef<HTMLDivElement, Props>(
|
|
13
|
+
function FormLevelError(props, ref) {
|
|
14
|
+
const { children, className, style, ...rest } = props
|
|
15
|
+
|
|
16
|
+
return (
|
|
17
|
+
<Container
|
|
18
|
+
{...rest}
|
|
19
|
+
ref={ref}
|
|
20
|
+
className={twMerge('mb-4', className)}
|
|
21
|
+
style={style}
|
|
22
|
+
>
|
|
23
|
+
<Alert variant='red'>{children}</Alert>
|
|
24
|
+
</Container>
|
|
25
|
+
)
|
|
26
|
+
}
|
|
27
|
+
)
|
|
28
|
+
|
|
29
|
+
FormLevelError.displayName = 'FormLevelError'
|
|
30
|
+
|
|
31
|
+
export default FormLevelError
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './FormLevelError'
|