@cerberus-design/react 0.1.3-next-86c9e1e → 0.1.3-next-cb1c11b

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.
@@ -56,6 +56,34 @@ declare interface FieldContextValue {
56
56
  export { FieldContextValue }
57
57
  export { FieldContextValue as FieldContextValue_alias_1 }
58
58
 
59
+ /**
60
+ * A component that provides feedback about the field.
61
+ * @description [FieldMessage Docs](https://cerberus.digitalu.design/react/field-message)
62
+ * @example
63
+ * ```tsx
64
+ * <Field>
65
+ * <Label htmlFor="first_name">First Name</Label>
66
+ * <Input aria-describedBy="help:first_name" id="first_name" type="text" />
67
+ * <FieldMessage id="help:first_name">
68
+ * This will only be used in your account information.
69
+ * </FieldMessage>
70
+ * </Field>
71
+ * ```
72
+ */
73
+ declare function FieldMessage(props: FieldMessageProps): JSX_2.Element;
74
+ export { FieldMessage }
75
+ export { FieldMessage as FieldMessage_alias_1 }
76
+
77
+ /**
78
+ * This module contains the FieldMessage component.
79
+ * @module
80
+ */
81
+ declare interface FieldMessageProps extends HTMLAttributes<HTMLParagraphElement> {
82
+ id: string;
83
+ }
84
+ export { FieldMessageProps }
85
+ export { FieldMessageProps as FieldMessageProps_alias_1 }
86
+
59
87
  declare function getPosition(position: Positions): GetPositionResult;
60
88
  export { getPosition }
61
89
  export { getPosition as getPosition_alias_1 }
@@ -0,0 +1,24 @@
1
+ import {
2
+ useFieldContext
3
+ } from "./chunk-KETL4ZJK.js";
4
+
5
+ // src/components/FieldMessage.tsx
6
+ import { cx } from "@cerberus/styled-system/css";
7
+ import { fieldMessage } from "@cerberus/styled-system/recipes";
8
+ import { jsx } from "react/jsx-runtime";
9
+ function FieldMessage(props) {
10
+ const { invalid } = useFieldContext();
11
+ return /* @__PURE__ */ jsx(
12
+ "small",
13
+ {
14
+ ...props,
15
+ ...invalid && { "aria-invalid": true },
16
+ className: cx(props.className, fieldMessage())
17
+ }
18
+ );
19
+ }
20
+
21
+ export {
22
+ FieldMessage
23
+ };
24
+ //# sourceMappingURL=chunk-6VY34K3P.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/components/FieldMessage.tsx"],"sourcesContent":["'use client'\n\nimport type { HTMLAttributes } from 'react'\nimport { cx } from '@cerberus/styled-system/css'\nimport { fieldMessage } from '@cerberus/styled-system/recipes'\nimport { useFieldContext } from '../context/field'\n\n/**\n * This module contains the FieldMessage component.\n * @module\n */\n\nexport interface FieldMessageProps\n extends HTMLAttributes<HTMLParagraphElement> {\n id: string\n}\n\n/**\n * A component that provides feedback about the field.\n * @description [FieldMessage Docs](https://cerberus.digitalu.design/react/field-message)\n * @example\n * ```tsx\n * <Field>\n * <Label htmlFor=\"first_name\">First Name</Label>\n * <Input aria-describedBy=\"help:first_name\" id=\"first_name\" type=\"text\" />\n * <FieldMessage id=\"help:first_name\">\n * This will only be used in your account information.\n * </FieldMessage>\n * </Field>\n * ```\n */\nexport function FieldMessage(props: FieldMessageProps) {\n const { invalid } = useFieldContext()\n return (\n <small\n {...props}\n {...(invalid && { 'aria-invalid': true })}\n className={cx(props.className, fieldMessage())}\n />\n )\n}\n"],"mappings":";;;;;AAGA,SAAS,UAAU;AACnB,SAAS,oBAAoB;AA8BzB;AAHG,SAAS,aAAa,OAA0B;AACrD,QAAM,EAAE,QAAQ,IAAI,gBAAgB;AACpC,SACE;AAAA,IAAC;AAAA;AAAA,MACE,GAAG;AAAA,MACH,GAAI,WAAW,EAAE,gBAAgB,KAAK;AAAA,MACvC,WAAW,GAAG,MAAM,WAAW,aAAa,CAAC;AAAA;AAAA,EAC/C;AAEJ;","names":[]}
@@ -1,9 +1,9 @@
1
- import {
2
- useFieldContext
3
- } from "./chunk-KETL4ZJK.js";
4
1
  import {
5
2
  Show
6
3
  } from "./chunk-R4H3352X.js";
4
+ import {
5
+ useFieldContext
6
+ } from "./chunk-KETL4ZJK.js";
7
7
 
8
8
  // src/components/Label.tsx
9
9
  import { label } from "@cerberus/styled-system/recipes";
@@ -27,14 +27,14 @@ function Label(props) {
27
27
  ),
28
28
  children: [
29
29
  props.children,
30
- /* @__PURE__ */ jsx(Show, { when: !required, children: /* @__PURE__ */ jsx(
30
+ /* @__PURE__ */ jsx(Show, { when: required, children: /* @__PURE__ */ jsx(
31
31
  "span",
32
32
  {
33
33
  className: css({
34
34
  color: "neutral.text.100",
35
35
  fontSize: "inherit"
36
36
  }),
37
- children: "(optional)"
37
+ children: "(required)"
38
38
  }
39
39
  ) })
40
40
  ]
@@ -45,4 +45,4 @@ function Label(props) {
45
45
  export {
46
46
  Label
47
47
  };
48
- //# sourceMappingURL=chunk-JCAWOVKD.js.map
48
+ //# sourceMappingURL=chunk-EYZ3S36P.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/components/Label.tsx"],"sourcesContent":["'use client'\n\nimport type { HTMLAttributes, PropsWithChildren } from 'react'\nimport { label } from '@cerberus/styled-system/recipes'\nimport { css, cx } from '@cerberus/styled-system/css'\nimport { useFieldContext } from '../context/field'\nimport { Show } from './Show'\nimport { hstack } from '@cerberus/styled-system/patterns'\n\n/**\n * This module contains the Label component.\n * @module\n */\n\nexport interface LabelProps extends HTMLAttributes<HTMLLabelElement> {\n htmlFor: string\n hidden?: boolean\n}\n\n/**\n * A screen ready friendly label component.\n * @definition [ARIA Forms](https://www.a11yproject.com/checklist/#forms)\n * @definition [Label docs](https://cerberus.digitalu.design/react/label)\n * @example\n * ```tsx\n * <Field required>\n * <Label htmlFor=\"test\">Test Label</Label>\n * </Field>\n * ```\n */\nexport function Label(props: PropsWithChildren<LabelProps>) {\n const { hidden, ...nativeProps } = props\n const { required } = useFieldContext()\n const usage = hidden ? 'hidden' : 'visible'\n\n return (\n <label\n {...nativeProps}\n className={cx(\n nativeProps.className,\n label({ usage }),\n hstack({\n justify: 'space-between',\n }),\n )}\n >\n {props.children}\n <Show when={!required}>\n <span\n className={css({\n color: 'neutral.text.100',\n fontSize: 'inherit',\n })}\n >\n (optional)\n </span>\n </Show>\n </label>\n )\n}\n"],"mappings":";;;;;;;;AAGA,SAAS,aAAa;AACtB,SAAS,KAAK,UAAU;AAGxB,SAAS,cAAc;AA6BnB,SAYI,KAZJ;AANG,SAAS,MAAM,OAAsC;AAC1D,QAAM,EAAE,QAAQ,GAAG,YAAY,IAAI;AACnC,QAAM,EAAE,SAAS,IAAI,gBAAgB;AACrC,QAAM,QAAQ,SAAS,WAAW;AAElC,SACE;AAAA,IAAC;AAAA;AAAA,MACE,GAAG;AAAA,MACJ,WAAW;AAAA,QACT,YAAY;AAAA,QACZ,MAAM,EAAE,MAAM,CAAC;AAAA,QACf,OAAO;AAAA,UACL,SAAS;AAAA,QACX,CAAC;AAAA,MACH;AAAA,MAEC;AAAA,cAAM;AAAA,QACP,oBAAC,QAAK,MAAM,CAAC,UACX;AAAA,UAAC;AAAA;AAAA,YACC,WAAW,IAAI;AAAA,cACb,OAAO;AAAA,cACP,UAAU;AAAA,YACZ,CAAC;AAAA,YACF;AAAA;AAAA,QAED,GACF;AAAA;AAAA;AAAA,EACF;AAEJ;","names":[]}
1
+ {"version":3,"sources":["../../src/components/Label.tsx"],"sourcesContent":["'use client'\n\nimport type { HTMLAttributes, PropsWithChildren } from 'react'\nimport { label } from '@cerberus/styled-system/recipes'\nimport { css, cx } from '@cerberus/styled-system/css'\nimport { useFieldContext } from '../context/field'\nimport { Show } from './Show'\nimport { hstack } from '@cerberus/styled-system/patterns'\n\n/**\n * This module contains the Label component.\n * @module\n */\n\nexport interface LabelProps extends HTMLAttributes<HTMLLabelElement> {\n htmlFor: string\n hidden?: boolean\n}\n\n/**\n * A screen ready friendly label component.\n * @definition [ARIA Forms](https://www.a11yproject.com/checklist/#forms)\n * @definition [Label docs](https://cerberus.digitalu.design/react/label)\n * @example\n * ```tsx\n * <Field required>\n * <Label htmlFor=\"test\">Test Label</Label>\n * </Field>\n * ```\n */\nexport function Label(props: PropsWithChildren<LabelProps>) {\n const { hidden, ...nativeProps } = props\n const { required } = useFieldContext()\n const usage = hidden ? 'hidden' : 'visible'\n\n return (\n <label\n {...nativeProps}\n className={cx(\n nativeProps.className,\n label({ usage }),\n hstack({\n justify: 'space-between',\n }),\n )}\n >\n {props.children}\n <Show when={required}>\n <span\n className={css({\n color: 'neutral.text.100',\n fontSize: 'inherit',\n })}\n >\n (required)\n </span>\n </Show>\n </label>\n )\n}\n"],"mappings":";;;;;;;;AAGA,SAAS,aAAa;AACtB,SAAS,KAAK,UAAU;AAGxB,SAAS,cAAc;AA6BnB,SAYI,KAZJ;AANG,SAAS,MAAM,OAAsC;AAC1D,QAAM,EAAE,QAAQ,GAAG,YAAY,IAAI;AACnC,QAAM,EAAE,SAAS,IAAI,gBAAgB;AACrC,QAAM,QAAQ,SAAS,WAAW;AAElC,SACE;AAAA,IAAC;AAAA;AAAA,MACE,GAAG;AAAA,MACJ,WAAW;AAAA,QACT,YAAY;AAAA,QACZ,MAAM,EAAE,MAAM,CAAC;AAAA,QACf,OAAO;AAAA,UACL,SAAS;AAAA,QACX,CAAC;AAAA,MACH;AAAA,MAEC;AAAA,cAAM;AAAA,QACP,oBAAC,QAAK,MAAM,UACV;AAAA,UAAC;AAAA;AAAA,YACC,WAAW,IAAI;AAAA,cACb,OAAO;AAAA,cACP,UAAU;AAAA,YACZ,CAAC;AAAA,YACF;AAAA;AAAA,QAED,GACF;AAAA;AAAA;AAAA,EACF;AAEJ;","names":[]}
@@ -0,0 +1,2 @@
1
+ export { FieldMessage_alias_1 as FieldMessage } from '../_tsup-dts-rollup';
2
+ export { FieldMessageProps_alias_1 as FieldMessageProps } from '../_tsup-dts-rollup';
@@ -0,0 +1,9 @@
1
+ "use client";
2
+ import {
3
+ FieldMessage
4
+ } from "../chunk-6VY34K3P.js";
5
+ import "../chunk-KETL4ZJK.js";
6
+ export {
7
+ FieldMessage
8
+ };
9
+ //# sourceMappingURL=FieldMessage.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
@@ -1,9 +1,9 @@
1
1
  "use client";
2
2
  import {
3
3
  Label
4
- } from "../chunk-JCAWOVKD.js";
5
- import "../chunk-KETL4ZJK.js";
4
+ } from "../chunk-EYZ3S36P.js";
6
5
  import "../chunk-R4H3352X.js";
6
+ import "../chunk-KETL4ZJK.js";
7
7
  export {
8
8
  Label
9
9
  };
@@ -1,5 +1,7 @@
1
1
  export { Button } from './_tsup-dts-rollup';
2
2
  export { ButtonProps } from './_tsup-dts-rollup';
3
+ export { FieldMessage } from './_tsup-dts-rollup';
4
+ export { FieldMessageProps } from './_tsup-dts-rollup';
3
5
  export { IconButton } from './_tsup-dts-rollup';
4
6
  export { IconButtonUsage } from './_tsup-dts-rollup';
5
7
  export { IconButtonProps } from './_tsup-dts-rollup';
@@ -1,3 +1,6 @@
1
+ import {
2
+ NavMenuLink
3
+ } from "./chunk-JA4IX7GN.js";
1
4
  import {
2
5
  NavMenuList,
3
6
  getPosition
@@ -23,25 +26,26 @@ import {
23
26
  import {
24
27
  Button
25
28
  } from "./chunk-XFWARXLU.js";
29
+ import {
30
+ FieldMessage
31
+ } from "./chunk-6VY34K3P.js";
26
32
  import {
27
33
  IconButton
28
34
  } from "./chunk-BPIYUAYS.js";
29
35
  import {
30
36
  Label
31
- } from "./chunk-JCAWOVKD.js";
37
+ } from "./chunk-EYZ3S36P.js";
38
+ import {
39
+ Show
40
+ } from "./chunk-R4H3352X.js";
32
41
  import {
33
42
  Field,
34
43
  useFieldContext
35
44
  } from "./chunk-KETL4ZJK.js";
36
- import {
37
- NavMenuLink
38
- } from "./chunk-JA4IX7GN.js";
39
- import {
40
- Show
41
- } from "./chunk-R4H3352X.js";
42
45
  export {
43
46
  Button,
44
47
  Field,
48
+ FieldMessage,
45
49
  IconButton,
46
50
  Label,
47
51
  MODE_KEY,
@@ -56,6 +56,34 @@ declare interface FieldContextValue {
56
56
  export { FieldContextValue }
57
57
  export { FieldContextValue as FieldContextValue_alias_1 }
58
58
 
59
+ /**
60
+ * A component that provides feedback about the field.
61
+ * @description [FieldMessage Docs](https://cerberus.digitalu.design/react/field-message)
62
+ * @example
63
+ * ```tsx
64
+ * <Field>
65
+ * <Label htmlFor="first_name">First Name</Label>
66
+ * <Input aria-describedBy="help:first_name" id="first_name" type="text" />
67
+ * <FieldMessage id="help:first_name">
68
+ * This will only be used in your account information.
69
+ * </FieldMessage>
70
+ * </Field>
71
+ * ```
72
+ */
73
+ declare function FieldMessage(props: FieldMessageProps): JSX_2.Element;
74
+ export { FieldMessage }
75
+ export { FieldMessage as FieldMessage_alias_1 }
76
+
77
+ /**
78
+ * This module contains the FieldMessage component.
79
+ * @module
80
+ */
81
+ declare interface FieldMessageProps extends HTMLAttributes<HTMLParagraphElement> {
82
+ id: string;
83
+ }
84
+ export { FieldMessageProps }
85
+ export { FieldMessageProps as FieldMessageProps_alias_1 }
86
+
59
87
  declare function getPosition(position: Positions): GetPositionResult;
60
88
  export { getPosition }
61
89
  export { getPosition as getPosition_alias_1 }
@@ -0,0 +1,24 @@
1
+ import {
2
+ useFieldContext
3
+ } from "./chunk-KETL4ZJK.js";
4
+
5
+ // src/components/FieldMessage.tsx
6
+ import { cx } from "@cerberus/styled-system/css";
7
+ import { fieldMessage } from "@cerberus/styled-system/recipes";
8
+ import { jsx } from "react/jsx-runtime";
9
+ function FieldMessage(props) {
10
+ const { invalid } = useFieldContext();
11
+ return /* @__PURE__ */ jsx(
12
+ "small",
13
+ {
14
+ ...props,
15
+ ...invalid && { "aria-invalid": true },
16
+ className: cx(props.className, fieldMessage())
17
+ }
18
+ );
19
+ }
20
+
21
+ export {
22
+ FieldMessage
23
+ };
24
+ //# sourceMappingURL=chunk-6VY34K3P.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/components/FieldMessage.tsx"],"sourcesContent":["'use client'\n\nimport type { HTMLAttributes } from 'react'\nimport { cx } from '@cerberus/styled-system/css'\nimport { fieldMessage } from '@cerberus/styled-system/recipes'\nimport { useFieldContext } from '../context/field'\n\n/**\n * This module contains the FieldMessage component.\n * @module\n */\n\nexport interface FieldMessageProps\n extends HTMLAttributes<HTMLParagraphElement> {\n id: string\n}\n\n/**\n * A component that provides feedback about the field.\n * @description [FieldMessage Docs](https://cerberus.digitalu.design/react/field-message)\n * @example\n * ```tsx\n * <Field>\n * <Label htmlFor=\"first_name\">First Name</Label>\n * <Input aria-describedBy=\"help:first_name\" id=\"first_name\" type=\"text\" />\n * <FieldMessage id=\"help:first_name\">\n * This will only be used in your account information.\n * </FieldMessage>\n * </Field>\n * ```\n */\nexport function FieldMessage(props: FieldMessageProps) {\n const { invalid } = useFieldContext()\n return (\n <small\n {...props}\n {...(invalid && { 'aria-invalid': true })}\n className={cx(props.className, fieldMessage())}\n />\n )\n}\n"],"mappings":";;;;;AAGA,SAAS,UAAU;AACnB,SAAS,oBAAoB;AA8BzB;AAHG,SAAS,aAAa,OAA0B;AACrD,QAAM,EAAE,QAAQ,IAAI,gBAAgB;AACpC,SACE;AAAA,IAAC;AAAA;AAAA,MACE,GAAG;AAAA,MACH,GAAI,WAAW,EAAE,gBAAgB,KAAK;AAAA,MACvC,WAAW,GAAG,MAAM,WAAW,aAAa,CAAC;AAAA;AAAA,EAC/C;AAEJ;","names":[]}
@@ -1,9 +1,9 @@
1
- import {
2
- useFieldContext
3
- } from "./chunk-KETL4ZJK.js";
4
1
  import {
5
2
  Show
6
3
  } from "./chunk-R4H3352X.js";
4
+ import {
5
+ useFieldContext
6
+ } from "./chunk-KETL4ZJK.js";
7
7
 
8
8
  // src/components/Label.tsx
9
9
  import { label } from "@cerberus/styled-system/recipes";
@@ -27,14 +27,14 @@ function Label(props) {
27
27
  ),
28
28
  children: [
29
29
  props.children,
30
- /* @__PURE__ */ jsx(Show, { when: !required, children: /* @__PURE__ */ jsx(
30
+ /* @__PURE__ */ jsx(Show, { when: required, children: /* @__PURE__ */ jsx(
31
31
  "span",
32
32
  {
33
33
  className: css({
34
34
  color: "neutral.text.100",
35
35
  fontSize: "inherit"
36
36
  }),
37
- children: "(optional)"
37
+ children: "(required)"
38
38
  }
39
39
  ) })
40
40
  ]
@@ -45,4 +45,4 @@ function Label(props) {
45
45
  export {
46
46
  Label
47
47
  };
48
- //# sourceMappingURL=chunk-JCAWOVKD.js.map
48
+ //# sourceMappingURL=chunk-EYZ3S36P.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/components/Label.tsx"],"sourcesContent":["'use client'\n\nimport type { HTMLAttributes, PropsWithChildren } from 'react'\nimport { label } from '@cerberus/styled-system/recipes'\nimport { css, cx } from '@cerberus/styled-system/css'\nimport { useFieldContext } from '../context/field'\nimport { Show } from './Show'\nimport { hstack } from '@cerberus/styled-system/patterns'\n\n/**\n * This module contains the Label component.\n * @module\n */\n\nexport interface LabelProps extends HTMLAttributes<HTMLLabelElement> {\n htmlFor: string\n hidden?: boolean\n}\n\n/**\n * A screen ready friendly label component.\n * @definition [ARIA Forms](https://www.a11yproject.com/checklist/#forms)\n * @definition [Label docs](https://cerberus.digitalu.design/react/label)\n * @example\n * ```tsx\n * <Field required>\n * <Label htmlFor=\"test\">Test Label</Label>\n * </Field>\n * ```\n */\nexport function Label(props: PropsWithChildren<LabelProps>) {\n const { hidden, ...nativeProps } = props\n const { required } = useFieldContext()\n const usage = hidden ? 'hidden' : 'visible'\n\n return (\n <label\n {...nativeProps}\n className={cx(\n nativeProps.className,\n label({ usage }),\n hstack({\n justify: 'space-between',\n }),\n )}\n >\n {props.children}\n <Show when={!required}>\n <span\n className={css({\n color: 'neutral.text.100',\n fontSize: 'inherit',\n })}\n >\n (optional)\n </span>\n </Show>\n </label>\n )\n}\n"],"mappings":";;;;;;;;AAGA,SAAS,aAAa;AACtB,SAAS,KAAK,UAAU;AAGxB,SAAS,cAAc;AA6BnB,SAYI,KAZJ;AANG,SAAS,MAAM,OAAsC;AAC1D,QAAM,EAAE,QAAQ,GAAG,YAAY,IAAI;AACnC,QAAM,EAAE,SAAS,IAAI,gBAAgB;AACrC,QAAM,QAAQ,SAAS,WAAW;AAElC,SACE;AAAA,IAAC;AAAA;AAAA,MACE,GAAG;AAAA,MACJ,WAAW;AAAA,QACT,YAAY;AAAA,QACZ,MAAM,EAAE,MAAM,CAAC;AAAA,QACf,OAAO;AAAA,UACL,SAAS;AAAA,QACX,CAAC;AAAA,MACH;AAAA,MAEC;AAAA,cAAM;AAAA,QACP,oBAAC,QAAK,MAAM,CAAC,UACX;AAAA,UAAC;AAAA;AAAA,YACC,WAAW,IAAI;AAAA,cACb,OAAO;AAAA,cACP,UAAU;AAAA,YACZ,CAAC;AAAA,YACF;AAAA;AAAA,QAED,GACF;AAAA;AAAA;AAAA,EACF;AAEJ;","names":[]}
1
+ {"version":3,"sources":["../../src/components/Label.tsx"],"sourcesContent":["'use client'\n\nimport type { HTMLAttributes, PropsWithChildren } from 'react'\nimport { label } from '@cerberus/styled-system/recipes'\nimport { css, cx } from '@cerberus/styled-system/css'\nimport { useFieldContext } from '../context/field'\nimport { Show } from './Show'\nimport { hstack } from '@cerberus/styled-system/patterns'\n\n/**\n * This module contains the Label component.\n * @module\n */\n\nexport interface LabelProps extends HTMLAttributes<HTMLLabelElement> {\n htmlFor: string\n hidden?: boolean\n}\n\n/**\n * A screen ready friendly label component.\n * @definition [ARIA Forms](https://www.a11yproject.com/checklist/#forms)\n * @definition [Label docs](https://cerberus.digitalu.design/react/label)\n * @example\n * ```tsx\n * <Field required>\n * <Label htmlFor=\"test\">Test Label</Label>\n * </Field>\n * ```\n */\nexport function Label(props: PropsWithChildren<LabelProps>) {\n const { hidden, ...nativeProps } = props\n const { required } = useFieldContext()\n const usage = hidden ? 'hidden' : 'visible'\n\n return (\n <label\n {...nativeProps}\n className={cx(\n nativeProps.className,\n label({ usage }),\n hstack({\n justify: 'space-between',\n }),\n )}\n >\n {props.children}\n <Show when={required}>\n <span\n className={css({\n color: 'neutral.text.100',\n fontSize: 'inherit',\n })}\n >\n (required)\n </span>\n </Show>\n </label>\n )\n}\n"],"mappings":";;;;;;;;AAGA,SAAS,aAAa;AACtB,SAAS,KAAK,UAAU;AAGxB,SAAS,cAAc;AA6BnB,SAYI,KAZJ;AANG,SAAS,MAAM,OAAsC;AAC1D,QAAM,EAAE,QAAQ,GAAG,YAAY,IAAI;AACnC,QAAM,EAAE,SAAS,IAAI,gBAAgB;AACrC,QAAM,QAAQ,SAAS,WAAW;AAElC,SACE;AAAA,IAAC;AAAA;AAAA,MACE,GAAG;AAAA,MACJ,WAAW;AAAA,QACT,YAAY;AAAA,QACZ,MAAM,EAAE,MAAM,CAAC;AAAA,QACf,OAAO;AAAA,UACL,SAAS;AAAA,QACX,CAAC;AAAA,MACH;AAAA,MAEC;AAAA,cAAM;AAAA,QACP,oBAAC,QAAK,MAAM,UACV;AAAA,UAAC;AAAA;AAAA,YACC,WAAW,IAAI;AAAA,cACb,OAAO;AAAA,cACP,UAAU;AAAA,YACZ,CAAC;AAAA,YACF;AAAA;AAAA,QAED,GACF;AAAA;AAAA;AAAA,EACF;AAEJ;","names":[]}
@@ -0,0 +1,2 @@
1
+ export { FieldMessage_alias_1 as FieldMessage } from '../_tsup-dts-rollup';
2
+ export { FieldMessageProps_alias_1 as FieldMessageProps } from '../_tsup-dts-rollup';
@@ -0,0 +1,9 @@
1
+ "use client";
2
+ import {
3
+ FieldMessage
4
+ } from "../chunk-6VY34K3P.js";
5
+ import "../chunk-KETL4ZJK.js";
6
+ export {
7
+ FieldMessage
8
+ };
9
+ //# sourceMappingURL=FieldMessage.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
@@ -1,9 +1,9 @@
1
1
  "use client";
2
2
  import {
3
3
  Label
4
- } from "../chunk-JCAWOVKD.js";
5
- import "../chunk-KETL4ZJK.js";
4
+ } from "../chunk-EYZ3S36P.js";
6
5
  import "../chunk-R4H3352X.js";
6
+ import "../chunk-KETL4ZJK.js";
7
7
  export {
8
8
  Label
9
9
  };
@@ -1,5 +1,7 @@
1
1
  export { Button } from './_tsup-dts-rollup';
2
2
  export { ButtonProps } from './_tsup-dts-rollup';
3
+ export { FieldMessage } from './_tsup-dts-rollup';
4
+ export { FieldMessageProps } from './_tsup-dts-rollup';
3
5
  export { IconButton } from './_tsup-dts-rollup';
4
6
  export { IconButtonUsage } from './_tsup-dts-rollup';
5
7
  export { IconButtonProps } from './_tsup-dts-rollup';
@@ -1,3 +1,6 @@
1
+ import {
2
+ NavMenuLink
3
+ } from "./chunk-JA4IX7GN.js";
1
4
  import {
2
5
  NavMenuList,
3
6
  getPosition
@@ -23,25 +26,26 @@ import {
23
26
  import {
24
27
  Button
25
28
  } from "./chunk-XFWARXLU.js";
29
+ import {
30
+ FieldMessage
31
+ } from "./chunk-6VY34K3P.js";
26
32
  import {
27
33
  IconButton
28
34
  } from "./chunk-BPIYUAYS.js";
29
35
  import {
30
36
  Label
31
- } from "./chunk-JCAWOVKD.js";
37
+ } from "./chunk-EYZ3S36P.js";
38
+ import {
39
+ Show
40
+ } from "./chunk-R4H3352X.js";
32
41
  import {
33
42
  Field,
34
43
  useFieldContext
35
44
  } from "./chunk-KETL4ZJK.js";
36
- import {
37
- NavMenuLink
38
- } from "./chunk-JA4IX7GN.js";
39
- import {
40
- Show
41
- } from "./chunk-R4H3352X.js";
42
45
  export {
43
46
  Button,
44
47
  Field,
48
+ FieldMessage,
45
49
  IconButton,
46
50
  Label,
47
51
  MODE_KEY,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cerberus-design/react",
3
- "version": "0.1.3-next-86c9e1e",
3
+ "version": "0.1.3-next-cb1c11b",
4
4
  "description": "The Cerberus Design React component library.",
5
5
  "browserslist": "> 0.25%, not dead",
6
6
  "sideEffects": false,
@@ -0,0 +1,41 @@
1
+ 'use client'
2
+
3
+ import type { HTMLAttributes } from 'react'
4
+ import { cx } from '@cerberus/styled-system/css'
5
+ import { fieldMessage } from '@cerberus/styled-system/recipes'
6
+ import { useFieldContext } from '../context/field'
7
+
8
+ /**
9
+ * This module contains the FieldMessage component.
10
+ * @module
11
+ */
12
+
13
+ export interface FieldMessageProps
14
+ extends HTMLAttributes<HTMLParagraphElement> {
15
+ id: string
16
+ }
17
+
18
+ /**
19
+ * A component that provides feedback about the field.
20
+ * @description [FieldMessage Docs](https://cerberus.digitalu.design/react/field-message)
21
+ * @example
22
+ * ```tsx
23
+ * <Field>
24
+ * <Label htmlFor="first_name">First Name</Label>
25
+ * <Input aria-describedBy="help:first_name" id="first_name" type="text" />
26
+ * <FieldMessage id="help:first_name">
27
+ * This will only be used in your account information.
28
+ * </FieldMessage>
29
+ * </Field>
30
+ * ```
31
+ */
32
+ export function FieldMessage(props: FieldMessageProps) {
33
+ const { invalid } = useFieldContext()
34
+ return (
35
+ <small
36
+ {...props}
37
+ {...(invalid && { 'aria-invalid': true })}
38
+ className={cx(props.className, fieldMessage())}
39
+ />
40
+ )
41
+ }
@@ -45,14 +45,14 @@ export function Label(props: PropsWithChildren<LabelProps>) {
45
45
  )}
46
46
  >
47
47
  {props.children}
48
- <Show when={!required}>
48
+ <Show when={required}>
49
49
  <span
50
50
  className={css({
51
51
  color: 'neutral.text.100',
52
52
  fontSize: 'inherit',
53
53
  })}
54
54
  >
55
- (optional)
55
+ (required)
56
56
  </span>
57
57
  </Show>
58
58
  </label>
package/src/index.ts CHANGED
@@ -6,6 +6,7 @@
6
6
  // components
7
7
 
8
8
  export * from './components/Button'
9
+ export * from './components/FieldMessage'
9
10
  export * from './components/IconButton'
10
11
  export * from './components/Label'
11
12
  export * from './components/NavMenuTrigger'