@toptal/picasso-form 6.2.2-alpha-HG-917-fix-overlapping-sidebar-295fb9c4b.9 → 6.3.1-alpha-HG-917-fix-overlapping-sidebar-3957b1ee3.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.
Files changed (34) hide show
  1. package/dist-package/src/FormCompound/index.d.ts +1 -0
  2. package/dist-package/src/FormCompound/index.d.ts.map +1 -1
  3. package/dist-package/src/FormCompound/index.js +2 -0
  4. package/dist-package/src/FormCompound/index.js.map +1 -1
  5. package/dist-package/src/FormField/FormField.d.ts +4 -2
  6. package/dist-package/src/FormField/FormField.d.ts.map +1 -1
  7. package/dist-package/src/FormField/FormField.js +4 -2
  8. package/dist-package/src/FormField/FormField.js.map +1 -1
  9. package/dist-package/src/FormWarning/FormWarning.d.ts +10 -0
  10. package/dist-package/src/FormWarning/FormWarning.d.ts.map +1 -0
  11. package/dist-package/src/FormWarning/FormWarning.js +22 -0
  12. package/dist-package/src/FormWarning/FormWarning.js.map +1 -0
  13. package/dist-package/src/FormWarning/index.d.ts +5 -0
  14. package/dist-package/src/FormWarning/index.d.ts.map +1 -0
  15. package/dist-package/src/FormWarning/index.js +2 -0
  16. package/dist-package/src/FormWarning/index.js.map +1 -0
  17. package/dist-package/src/index.d.ts +1 -0
  18. package/dist-package/src/index.d.ts.map +1 -1
  19. package/dist-package/src/index.js +1 -0
  20. package/dist-package/src/index.js.map +1 -1
  21. package/package.json +15 -15
  22. package/src/Form/story/index.jsx +2 -0
  23. package/src/FormCompound/index.ts +2 -0
  24. package/src/FormField/FormField.tsx +13 -3
  25. package/src/FormField/story/Error.example.tsx +10 -0
  26. package/src/FormField/story/ErrorAndWarning.example.tsx +25 -0
  27. package/src/FormField/story/Warning.example.tsx +22 -0
  28. package/src/FormField/story/index.jsx +6 -0
  29. package/src/FormWarning/FormWarning.tsx +33 -0
  30. package/src/FormWarning/__snapshots__/test.tsx.snap +57 -0
  31. package/src/FormWarning/index.ts +6 -0
  32. package/src/FormWarning/story/index.jsx +9 -0
  33. package/src/FormWarning/test.tsx +34 -0
  34. package/src/index.ts +1 -0
@@ -4,5 +4,6 @@ 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>>;
7
8
  };
8
9
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/FormCompound/index.ts"],"names":[],"mappings":";AAOA,eAAO,MAAM,YAAY;;;;;CAKvB,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/FormCompound/index.ts"],"names":[],"mappings":";AAQA,eAAO,MAAM,YAAY;;;;;;CAMvB,CAAA"}
@@ -3,10 +3,12 @@ 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';
6
7
  export const FormCompound = Object.assign(Form, {
7
8
  Field: FormField,
8
9
  Hint: FormHint,
9
10
  Error: FormError,
10
11
  Label: FormLabel,
12
+ Warning: FormWarning,
11
13
  });
12
14
  //# 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;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"}
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;AACtC,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAA;AAE5C,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;IAChB,OAAO,EAAE,WAAW;CACrB,CAAC,CAAA"}
@@ -3,9 +3,11 @@ 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 | ReactNode;
7
7
  /** The text of the error */
8
- error?: string;
8
+ error?: string | ReactNode;
9
+ /** The text of the warning */
10
+ warning?: string | ReactNode;
9
11
  /** The content of the Form.Field */
10
12
  children: ReactNode;
11
13
  /** Field requirements for this specific field */
@@ -1 +1 @@
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"}
1
+ {"version":3,"file":"FormField.d.ts","sourceRoot":"","sources":["../../../src/FormField/FormField.tsx"],"names":[],"mappings":"AACA,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;AAUvD,MAAM,WAAW,KAAM,SAAQ,SAAS,EAAE,cAAc,CAAC,cAAc,CAAC;IACtE,2BAA2B;IAC3B,IAAI,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;IACzB,4BAA4B;IAC5B,KAAK,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;IAC1B,8BAA8B;IAC9B,OAAO,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;IAC5B,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,8EAuDpB,CAAA;AAMF,eAAe,SAAS,CAAA"}
@@ -16,6 +16,7 @@ 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';
19
20
  const FormFieldAdornments = ({ autoSaveIndicator, children, hasMultilineCounter, }) => {
20
21
  const { layout } = useFieldsLayoutContext();
21
22
  const isHorizontal = layout === 'horizontal';
@@ -30,7 +31,7 @@ const FormFieldAdornments = ({ autoSaveIndicator, children, hasMultilineCounter,
30
31
  React.createElement(Container, { className: twJoin('absolute right-0', hasMultilineCounter ? '-top-[0.875rem]' : 'top-0') }, autoSaveIndicator)));
31
32
  };
32
33
  export const FormField = forwardRef(function FormField(props, ref) {
33
- const { autoSaveIndicator, className, style, hint, children, error, fieldRequirements, hasMultilineCounter } = props, rest = __rest(props, ["autoSaveIndicator", "className", "style", "hint", "children", "error", "fieldRequirements", "hasMultilineCounter"]);
34
+ const { autoSaveIndicator, className, style, hint, children, error, warning, fieldRequirements, hasMultilineCounter } = props, rest = __rest(props, ["autoSaveIndicator", "className", "style", "hint", "children", "error", "warning", "fieldRequirements", "hasMultilineCounter"]);
34
35
  const { layout, labelWidth } = useFieldsLayoutContext();
35
36
  const isHorizontal = layout === 'horizontal';
36
37
  const labelWidthStyles = isHorizontal
@@ -40,7 +41,8 @@ export const FormField = forwardRef(function FormField(props, ref) {
40
41
  children,
41
42
  React.createElement(FormFieldAdornments, { autoSaveIndicator: autoSaveIndicator, hasMultilineCounter: hasMultilineCounter },
42
43
  error && React.createElement(FormError, null, error),
43
- hint && (React.createElement(FormHint, { className: twJoin(error && hint && 'mt-0') }, hint)),
44
+ warning && (React.createElement(FormWarning, { className: twJoin(error && hint && 'mt-0') }, warning)),
45
+ hint && (React.createElement(FormHint, { className: twJoin((error || warning) && hint && 'mt-0') }, hint)),
44
46
  fieldRequirements)));
45
47
  });
46
48
  FormField.defaultProps = {};
@@ -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;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,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ACf;YACA,IAAI,IAAI,CACP,oBAAC,QAAQ,IAAC,SAAS,EAAE,MAAM,CAAC,CAAC,KAAK,IAAI,OAAO,CAAC,IAAI,IAAI,IAAI,MAAM,CAAC,IAC9D,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"}
@@ -0,0 +1,10 @@
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
@@ -0,0 +1 @@
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"}
@@ -0,0 +1,22 @@
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
@@ -0,0 +1 @@
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"}
@@ -0,0 +1,5 @@
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
@@ -0,0 +1 @@
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"}
@@ -0,0 +1,2 @@
1
+ export { default as FormWarning } from './FormWarning';
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/FormWarning/index.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,eAAe,CAAA"}
@@ -2,6 +2,7 @@ export * from './FormCompound';
2
2
  export * from './Form';
3
3
  export * from './FormError';
4
4
  export * from './FormHint';
5
+ export * from './FormWarning';
5
6
  export * from './FormField';
6
7
  export type { FieldsLayoutContextProviderProps, FieldsLayoutContextValue, FieldLayout, LabelColumnSize, ResponsiveLabelColumnSize, } from '@toptal/picasso-form-layout';
7
8
  export { useFieldsLayoutContext, FieldsLayoutContextProvider, } from '@toptal/picasso-form-layout';
@@ -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,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"}
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,eAAe,CAAA;AAC7B,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"}
@@ -2,6 +2,7 @@ export * from './FormCompound';
2
2
  export * from './Form';
3
3
  export * from './FormError';
4
4
  export * from './FormHint';
5
+ export * from './FormWarning';
5
6
  export * from './FormField';
6
7
  export { useFieldsLayoutContext, FieldsLayoutContextProvider, } from '@toptal/picasso-form-layout';
7
8
  export * from './FormAutoSaveIndicator';
@@ -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;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"}
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,eAAe,CAAA;AAC7B,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.2.2-alpha-HG-917-fix-overlapping-sidebar-295fb9c4b.9+295fb9c4b",
3
+ "version": "6.3.1-alpha-HG-917-fix-overlapping-sidebar-3957b1ee3.0+3957b1ee3",
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-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",
25
+ "@toptal/picasso-alert": "3.0.33-alpha-HG-917-fix-overlapping-sidebar-3957b1ee3.11+3957b1ee3",
26
+ "@toptal/picasso-collapse": "3.0.4-alpha-HG-917-fix-overlapping-sidebar-3957b1ee3.11+3957b1ee3",
27
+ "@toptal/picasso-container": "3.1.3-alpha-HG-917-fix-overlapping-sidebar-3957b1ee3.11+3957b1ee3",
28
+ "@toptal/picasso-form-label": "1.0.3-alpha-HG-917-fix-overlapping-sidebar-3957b1ee3.11+3957b1ee3",
29
+ "@toptal/picasso-form-layout": "1.0.3-alpha-HG-917-fix-overlapping-sidebar-3957b1ee3.11+3957b1ee3",
30
+ "@toptal/picasso-grid": "5.0.10-alpha-HG-917-fix-overlapping-sidebar-3957b1ee3.11+3957b1ee3",
31
+ "@toptal/picasso-icons": "1.12.2-alpha-HG-917-fix-overlapping-sidebar-3957b1ee3.11+3957b1ee3",
32
+ "@toptal/picasso-shared": "15.0.1-alpha-HG-917-fix-overlapping-sidebar-3957b1ee3.357+3957b1ee3",
33
+ "@toptal/picasso-typography": "4.0.4-alpha-HG-917-fix-overlapping-sidebar-3957b1ee3.11+3957b1ee3",
34
+ "@toptal/picasso-utils": "3.1.1-alpha-HG-917-fix-overlapping-sidebar-3957b1ee3.11+3957b1ee3",
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-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"
54
+ "@toptal/picasso-provider": "5.0.1-alpha-HG-917-fix-overlapping-sidebar-3957b1ee3.278+3957b1ee3",
55
+ "@toptal/picasso-tailwind-merge": "2.0.4-alpha-HG-917-fix-overlapping-sidebar-3957b1ee3.11+3957b1ee3",
56
+ "@toptal/picasso-test-utils": "1.1.2-alpha-HG-917-fix-overlapping-sidebar-3957b1ee3.357+3957b1ee3"
57
57
  },
58
58
  "files": [
59
59
  "dist-package/**",
60
60
  "!dist-package/tsconfig.tsbuildinfo",
61
61
  "src"
62
62
  ],
63
- "gitHead": "295fb9c4b3bc6f247af449aee17dd2d5ea56613a"
63
+ "gitHead": "3957b1ee38417e2370b7cfd8546a9b66b395befe"
64
64
  }
@@ -4,6 +4,7 @@ import { Form } from '../Form'
4
4
  import formFieldStory from '../../FormField/story'
5
5
  import formHintStory from '../../FormHint/story'
6
6
  import formErrorStory from '../../FormError/story'
7
+ import formWarningStory from '../../FormWarning/story'
7
8
  import PicassoBook from '~/.storybook/components/PicassoBook'
8
9
 
9
10
  const page = PicassoBook.section('Forms').createPage(
@@ -25,6 +26,7 @@ page
25
26
  .addComponentDocs(formHintStory.componentDocs)
26
27
  .addComponentDocs(formLabelStory.componentDocs)
27
28
  .addComponentDocs(formErrorStory.componentDocs)
29
+ .addComponentDocs(formWarningStory.componentDocs)
28
30
 
29
31
  page.createChapter().addExample(
30
32
  'Form/story/Error.example.tsx',
@@ -4,10 +4,12 @@ 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'
7
8
 
8
9
  export const FormCompound = Object.assign(Form, {
9
10
  Field: FormField,
10
11
  Hint: FormHint,
11
12
  Error: FormError,
12
13
  Label: FormLabel,
14
+ Warning: FormWarning,
13
15
  })
@@ -1,3 +1,4 @@
1
+ /* eslint-disable complexity */
1
2
  import type { ReactNode, HTMLAttributes } from 'react'
2
3
  import React, { forwardRef, Children } from 'react'
3
4
  import type { BaseProps } from '@toptal/picasso-shared'
@@ -8,12 +9,15 @@ import { useFieldsLayoutContext } from '@toptal/picasso-form-layout'
8
9
  import { FormHint } from '../FormHint'
9
10
  import { FormError } from '../FormError'
10
11
  import { createLabelWidthStyles, horizontalLayoutClasses } from './styles'
12
+ import { FormWarning } from '../FormWarning'
11
13
 
12
14
  export interface Props extends BaseProps, HTMLAttributes<HTMLDivElement> {
13
15
  /** The text of the hint */
14
- hint?: string
16
+ hint?: string | ReactNode
15
17
  /** The text of the error */
16
- error?: string
18
+ error?: string | ReactNode
19
+ /** The text of the warning */
20
+ warning?: string | ReactNode
17
21
  /** The content of the Form.Field */
18
22
  children: ReactNode
19
23
  /** Field requirements for this specific field */
@@ -79,6 +83,7 @@ export const FormField = forwardRef<HTMLDivElement, Props>(function FormField(
79
83
  hint,
80
84
  children,
81
85
  error,
86
+ warning,
82
87
  fieldRequirements,
83
88
  hasMultilineCounter,
84
89
  ...rest
@@ -108,8 +113,13 @@ export const FormField = forwardRef<HTMLDivElement, Props>(function FormField(
108
113
  hasMultilineCounter={hasMultilineCounter}
109
114
  >
110
115
  {error && <FormError>{error}</FormError>}
116
+ {warning && (
117
+ <FormWarning className={twJoin(error && hint && 'mt-0')}>
118
+ {warning}
119
+ </FormWarning>
120
+ )}
111
121
  {hint && (
112
- <FormHint className={twJoin(error && hint && 'mt-0')}>
122
+ <FormHint className={twJoin((error || warning) && hint && 'mt-0')}>
113
123
  {hint}
114
124
  </FormHint>
115
125
  )}
@@ -14,6 +14,16 @@ 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>
17
27
  </Form>
18
28
  </Grid.Item>
19
29
  </Grid>
@@ -0,0 +1,25 @@
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
@@ -0,0 +1,22 @@
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
@@ -12,6 +12,12 @@ 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
+ )
15
21
  .addExample('FormField/story/Hint.example.tsx', 'Hint', 'base/Form')
16
22
  .addExample(
17
23
  'FormField/story/HintAndError.example.tsx',
@@ -0,0 +1,33 @@
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
@@ -0,0 +1,57 @@
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
+ `;
@@ -0,0 +1,6 @@
1
+ import type { OmitInternalProps } from '@toptal/picasso-shared'
2
+
3
+ import type { Props } from './FormWarning'
4
+
5
+ export { default as FormWarning } from './FormWarning'
6
+ export type FormWarningProps = OmitInternalProps<Props>
@@ -0,0 +1,9 @@
1
+ import { FormWarning } from '../FormWarning'
2
+ import PicassoBook from '~/.storybook/components/PicassoBook'
3
+
4
+ const componentDocs = PicassoBook.createComponentDocs(
5
+ FormWarning,
6
+ 'Form.Warning'
7
+ )
8
+
9
+ export default { componentDocs }
@@ -0,0 +1,34 @@
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
+ })
package/src/index.ts CHANGED
@@ -2,6 +2,7 @@ export * from './FormCompound'
2
2
  export * from './Form'
3
3
  export * from './FormError'
4
4
  export * from './FormHint'
5
+ export * from './FormWarning'
5
6
  export * from './FormField'
6
7
  export type {
7
8
  FieldsLayoutContextProviderProps,