@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.
- package/build/legacy/_tsup-dts-rollup.d.ts +28 -0
- package/build/legacy/chunk-6VY34K3P.js +24 -0
- package/build/legacy/chunk-6VY34K3P.js.map +1 -0
- package/build/legacy/{chunk-JCAWOVKD.js → chunk-EYZ3S36P.js} +6 -6
- package/build/legacy/{chunk-JCAWOVKD.js.map → chunk-EYZ3S36P.js.map} +1 -1
- package/build/legacy/components/FieldMessage.d.ts +2 -0
- package/build/legacy/components/FieldMessage.js +9 -0
- package/build/legacy/components/FieldMessage.js.map +1 -0
- package/build/legacy/components/Label.js +2 -2
- package/build/legacy/index.d.ts +2 -0
- package/build/legacy/index.js +11 -7
- package/build/modern/_tsup-dts-rollup.d.ts +28 -0
- package/build/modern/chunk-6VY34K3P.js +24 -0
- package/build/modern/chunk-6VY34K3P.js.map +1 -0
- package/build/modern/{chunk-JCAWOVKD.js → chunk-EYZ3S36P.js} +6 -6
- package/build/modern/{chunk-JCAWOVKD.js.map → chunk-EYZ3S36P.js.map} +1 -1
- package/build/modern/components/FieldMessage.d.ts +2 -0
- package/build/modern/components/FieldMessage.js +9 -0
- package/build/modern/components/FieldMessage.js.map +1 -0
- package/build/modern/components/Label.js +2 -2
- package/build/modern/index.d.ts +2 -0
- package/build/modern/index.js +11 -7
- package/package.json +1 -1
- package/src/components/FieldMessage.tsx +41 -0
- package/src/components/Label.tsx +2 -2
- package/src/index.ts +1 -0
|
@@ -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:
|
|
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: "(
|
|
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-
|
|
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={
|
|
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 @@
|
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
package/build/legacy/index.d.ts
CHANGED
|
@@ -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';
|
package/build/legacy/index.js
CHANGED
|
@@ -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-
|
|
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:
|
|
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: "(
|
|
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-
|
|
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={
|
|
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 @@
|
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
package/build/modern/index.d.ts
CHANGED
|
@@ -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';
|
package/build/modern/index.js
CHANGED
|
@@ -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-
|
|
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
|
@@ -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
|
+
}
|
package/src/components/Label.tsx
CHANGED
|
@@ -45,14 +45,14 @@ export function Label(props: PropsWithChildren<LabelProps>) {
|
|
|
45
45
|
)}
|
|
46
46
|
>
|
|
47
47
|
{props.children}
|
|
48
|
-
<Show when={
|
|
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
|
-
(
|
|
55
|
+
(required)
|
|
56
56
|
</span>
|
|
57
57
|
</Show>
|
|
58
58
|
</label>
|