@cerberus-design/react 0.1.3-next-d78e6e2 → 0.1.3-next-b633e4b

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.
@@ -2,6 +2,7 @@ import type { AnchorHTMLAttributes } from 'react';
2
2
  import { ButtonHTMLAttributes } from 'react';
3
3
  import { ElementType } from 'react';
4
4
  import { HTMLAttributes } from 'react';
5
+ import { JSX as JSX_2 } from 'react/jsx-runtime';
5
6
  import { PropsWithChildren } from 'react';
6
7
  import { ReactNode } from 'react';
7
8
  import { RefObject } from 'react';
@@ -91,6 +92,32 @@ declare type IconButtonUsage = Exclude<ButtonProps['usage'], 'outline'>;
91
92
  export { IconButtonUsage }
92
93
  export { IconButtonUsage as IconButtonUsage_alias_1 }
93
94
 
95
+ /**
96
+ * A screen ready friendly label component.
97
+ * @definition [ARIA Forms](https://www.a11yproject.com/checklist/#forms)
98
+ * @definition [Label docs](https://cerberus.digitalu.design/react/label)
99
+ * @example
100
+ * ```tsx
101
+ * <Field required>
102
+ * <Label htmlFor="test">Test Label</Label>
103
+ * </Field>
104
+ * ```
105
+ */
106
+ declare function Label(props: PropsWithChildren<LabelProps>): JSX_2.Element;
107
+ export { Label }
108
+ export { Label as Label_alias_1 }
109
+
110
+ /**
111
+ * This module contains the Label component.
112
+ * @module
113
+ */
114
+ declare interface LabelProps extends HTMLAttributes<HTMLLabelElement> {
115
+ htmlFor: string;
116
+ hidden?: boolean;
117
+ }
118
+ export { LabelProps }
119
+ export { LabelProps as LabelProps_alias_1 }
120
+
94
121
  declare const MODE_KEY = "cerberus-mode";
95
122
  export { MODE_KEY }
96
123
  export { MODE_KEY as MODE_KEY_alias_1 }
@@ -0,0 +1,48 @@
1
+ import {
2
+ useFieldContext
3
+ } from "./chunk-KETL4ZJK.js";
4
+ import {
5
+ Show
6
+ } from "./chunk-R4H3352X.js";
7
+
8
+ // src/components/Label.tsx
9
+ import { label } from "@cerberus/styled-system/recipes";
10
+ import { css, cx } from "@cerberus/styled-system/css";
11
+ import { hstack } from "@cerberus/styled-system/patterns";
12
+ import { jsx, jsxs } from "react/jsx-runtime";
13
+ function Label(props) {
14
+ const { hidden, ...nativeProps } = props;
15
+ const { required } = useFieldContext();
16
+ const usage = hidden ? "hidden" : "visible";
17
+ return /* @__PURE__ */ jsxs(
18
+ "label",
19
+ {
20
+ ...nativeProps,
21
+ className: cx(
22
+ nativeProps.className,
23
+ label({ usage }),
24
+ hstack({
25
+ justify: "space-between"
26
+ })
27
+ ),
28
+ children: [
29
+ props.children,
30
+ /* @__PURE__ */ jsx(Show, { when: !required, children: /* @__PURE__ */ jsx(
31
+ "span",
32
+ {
33
+ className: css({
34
+ color: "neutral.text.100",
35
+ fontSize: "inherit"
36
+ }),
37
+ children: "optional"
38
+ }
39
+ ) })
40
+ ]
41
+ }
42
+ );
43
+ }
44
+
45
+ export {
46
+ Label
47
+ };
48
+ //# sourceMappingURL=chunk-F2AENE7H.js.map
@@ -0,0 +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,9 +1,9 @@
1
- import {
2
- createNavTriggerProps
3
- } from "./chunk-JF76VIL3.js";
4
1
  import {
5
2
  useNavMenuContext
6
3
  } from "./chunk-KJUCHZHV.js";
4
+ import {
5
+ createNavTriggerProps
6
+ } from "./chunk-JF76VIL3.js";
7
7
  import {
8
8
  Show
9
9
  } from "./chunk-R4H3352X.js";
@@ -79,4 +79,4 @@ function NavMenuTrigger(props) {
79
79
  export {
80
80
  NavMenuTrigger
81
81
  };
82
- //# sourceMappingURL=chunk-6YEAMVRY.js.map
82
+ //# sourceMappingURL=chunk-X6PHIZRM.js.map
@@ -0,0 +1,2 @@
1
+ export { Label_alias_1 as Label } from '../_tsup-dts-rollup';
2
+ export { LabelProps_alias_1 as LabelProps } from '../_tsup-dts-rollup';
@@ -0,0 +1,10 @@
1
+ "use client";
2
+ import {
3
+ Label
4
+ } from "../chunk-F2AENE7H.js";
5
+ import "../chunk-KETL4ZJK.js";
6
+ import "../chunk-R4H3352X.js";
7
+ export {
8
+ Label
9
+ };
10
+ //# sourceMappingURL=Label.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
  NavMenuTrigger
4
- } from "../chunk-6YEAMVRY.js";
5
- import "../chunk-JF76VIL3.js";
4
+ } from "../chunk-X6PHIZRM.js";
6
5
  import "../chunk-KJUCHZHV.js";
6
+ import "../chunk-JF76VIL3.js";
7
7
  import "../chunk-R4H3352X.js";
8
8
  export {
9
9
  NavMenuTrigger
@@ -3,6 +3,8 @@ export { ButtonProps } from './_tsup-dts-rollup';
3
3
  export { IconButton } from './_tsup-dts-rollup';
4
4
  export { IconButtonUsage } from './_tsup-dts-rollup';
5
5
  export { IconButtonProps } from './_tsup-dts-rollup';
6
+ export { Label } from './_tsup-dts-rollup';
7
+ export { LabelProps } from './_tsup-dts-rollup';
6
8
  export { NavMenuTrigger } from './_tsup-dts-rollup';
7
9
  export { NavMenuTriggerProps } from './_tsup-dts-rollup';
8
10
  export { getPosition } from './_tsup-dts-rollup';
@@ -1,10 +1,14 @@
1
+ import {
2
+ NavMenuList,
3
+ getPosition
4
+ } from "./chunk-WSQTX34C.js";
1
5
  import {
2
6
  NavMenuTrigger
3
- } from "./chunk-6YEAMVRY.js";
7
+ } from "./chunk-X6PHIZRM.js";
4
8
  import {
5
- Field,
6
- useFieldContext
7
- } from "./chunk-KETL4ZJK.js";
9
+ NavMenu,
10
+ useNavMenuContext
11
+ } from "./chunk-KJUCHZHV.js";
8
12
  import "./chunk-55J6XMHW.js";
9
13
  import {
10
14
  createNavTriggerProps
@@ -23,16 +27,15 @@ import {
23
27
  IconButton
24
28
  } from "./chunk-BPIYUAYS.js";
25
29
  import {
26
- NavMenuLink
27
- } from "./chunk-JA4IX7GN.js";
30
+ Label
31
+ } from "./chunk-F2AENE7H.js";
28
32
  import {
29
- NavMenuList,
30
- getPosition
31
- } from "./chunk-WSQTX34C.js";
33
+ Field,
34
+ useFieldContext
35
+ } from "./chunk-KETL4ZJK.js";
32
36
  import {
33
- NavMenu,
34
- useNavMenuContext
35
- } from "./chunk-KJUCHZHV.js";
37
+ NavMenuLink
38
+ } from "./chunk-JA4IX7GN.js";
36
39
  import {
37
40
  Show
38
41
  } from "./chunk-R4H3352X.js";
@@ -40,6 +43,7 @@ export {
40
43
  Button,
41
44
  Field,
42
45
  IconButton,
46
+ Label,
43
47
  MODE_KEY,
44
48
  NavMenu,
45
49
  NavMenuLink,
@@ -2,6 +2,7 @@ import type { AnchorHTMLAttributes } from 'react';
2
2
  import { ButtonHTMLAttributes } from 'react';
3
3
  import { ElementType } from 'react';
4
4
  import { HTMLAttributes } from 'react';
5
+ import { JSX as JSX_2 } from 'react/jsx-runtime';
5
6
  import { PropsWithChildren } from 'react';
6
7
  import { ReactNode } from 'react';
7
8
  import { RefObject } from 'react';
@@ -91,6 +92,32 @@ declare type IconButtonUsage = Exclude<ButtonProps['usage'], 'outline'>;
91
92
  export { IconButtonUsage }
92
93
  export { IconButtonUsage as IconButtonUsage_alias_1 }
93
94
 
95
+ /**
96
+ * A screen ready friendly label component.
97
+ * @definition [ARIA Forms](https://www.a11yproject.com/checklist/#forms)
98
+ * @definition [Label docs](https://cerberus.digitalu.design/react/label)
99
+ * @example
100
+ * ```tsx
101
+ * <Field required>
102
+ * <Label htmlFor="test">Test Label</Label>
103
+ * </Field>
104
+ * ```
105
+ */
106
+ declare function Label(props: PropsWithChildren<LabelProps>): JSX_2.Element;
107
+ export { Label }
108
+ export { Label as Label_alias_1 }
109
+
110
+ /**
111
+ * This module contains the Label component.
112
+ * @module
113
+ */
114
+ declare interface LabelProps extends HTMLAttributes<HTMLLabelElement> {
115
+ htmlFor: string;
116
+ hidden?: boolean;
117
+ }
118
+ export { LabelProps }
119
+ export { LabelProps as LabelProps_alias_1 }
120
+
94
121
  declare const MODE_KEY = "cerberus-mode";
95
122
  export { MODE_KEY }
96
123
  export { MODE_KEY as MODE_KEY_alias_1 }
@@ -0,0 +1,48 @@
1
+ import {
2
+ useFieldContext
3
+ } from "./chunk-KETL4ZJK.js";
4
+ import {
5
+ Show
6
+ } from "./chunk-R4H3352X.js";
7
+
8
+ // src/components/Label.tsx
9
+ import { label } from "@cerberus/styled-system/recipes";
10
+ import { css, cx } from "@cerberus/styled-system/css";
11
+ import { hstack } from "@cerberus/styled-system/patterns";
12
+ import { jsx, jsxs } from "react/jsx-runtime";
13
+ function Label(props) {
14
+ const { hidden, ...nativeProps } = props;
15
+ const { required } = useFieldContext();
16
+ const usage = hidden ? "hidden" : "visible";
17
+ return /* @__PURE__ */ jsxs(
18
+ "label",
19
+ {
20
+ ...nativeProps,
21
+ className: cx(
22
+ nativeProps.className,
23
+ label({ usage }),
24
+ hstack({
25
+ justify: "space-between"
26
+ })
27
+ ),
28
+ children: [
29
+ props.children,
30
+ /* @__PURE__ */ jsx(Show, { when: !required, children: /* @__PURE__ */ jsx(
31
+ "span",
32
+ {
33
+ className: css({
34
+ color: "neutral.text.100",
35
+ fontSize: "inherit"
36
+ }),
37
+ children: "optional"
38
+ }
39
+ ) })
40
+ ]
41
+ }
42
+ );
43
+ }
44
+
45
+ export {
46
+ Label
47
+ };
48
+ //# sourceMappingURL=chunk-F2AENE7H.js.map
@@ -0,0 +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,9 +1,9 @@
1
- import {
2
- createNavTriggerProps
3
- } from "./chunk-JF76VIL3.js";
4
1
  import {
5
2
  useNavMenuContext
6
3
  } from "./chunk-KJUCHZHV.js";
4
+ import {
5
+ createNavTriggerProps
6
+ } from "./chunk-JF76VIL3.js";
7
7
  import {
8
8
  Show
9
9
  } from "./chunk-R4H3352X.js";
@@ -79,4 +79,4 @@ function NavMenuTrigger(props) {
79
79
  export {
80
80
  NavMenuTrigger
81
81
  };
82
- //# sourceMappingURL=chunk-6YEAMVRY.js.map
82
+ //# sourceMappingURL=chunk-X6PHIZRM.js.map
@@ -0,0 +1,2 @@
1
+ export { Label_alias_1 as Label } from '../_tsup-dts-rollup';
2
+ export { LabelProps_alias_1 as LabelProps } from '../_tsup-dts-rollup';
@@ -0,0 +1,10 @@
1
+ "use client";
2
+ import {
3
+ Label
4
+ } from "../chunk-F2AENE7H.js";
5
+ import "../chunk-KETL4ZJK.js";
6
+ import "../chunk-R4H3352X.js";
7
+ export {
8
+ Label
9
+ };
10
+ //# sourceMappingURL=Label.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
  NavMenuTrigger
4
- } from "../chunk-6YEAMVRY.js";
5
- import "../chunk-JF76VIL3.js";
4
+ } from "../chunk-X6PHIZRM.js";
6
5
  import "../chunk-KJUCHZHV.js";
6
+ import "../chunk-JF76VIL3.js";
7
7
  import "../chunk-R4H3352X.js";
8
8
  export {
9
9
  NavMenuTrigger
@@ -3,6 +3,8 @@ export { ButtonProps } from './_tsup-dts-rollup';
3
3
  export { IconButton } from './_tsup-dts-rollup';
4
4
  export { IconButtonUsage } from './_tsup-dts-rollup';
5
5
  export { IconButtonProps } from './_tsup-dts-rollup';
6
+ export { Label } from './_tsup-dts-rollup';
7
+ export { LabelProps } from './_tsup-dts-rollup';
6
8
  export { NavMenuTrigger } from './_tsup-dts-rollup';
7
9
  export { NavMenuTriggerProps } from './_tsup-dts-rollup';
8
10
  export { getPosition } from './_tsup-dts-rollup';
@@ -1,10 +1,14 @@
1
+ import {
2
+ NavMenuList,
3
+ getPosition
4
+ } from "./chunk-WSQTX34C.js";
1
5
  import {
2
6
  NavMenuTrigger
3
- } from "./chunk-6YEAMVRY.js";
7
+ } from "./chunk-X6PHIZRM.js";
4
8
  import {
5
- Field,
6
- useFieldContext
7
- } from "./chunk-KETL4ZJK.js";
9
+ NavMenu,
10
+ useNavMenuContext
11
+ } from "./chunk-KJUCHZHV.js";
8
12
  import "./chunk-55J6XMHW.js";
9
13
  import {
10
14
  createNavTriggerProps
@@ -23,16 +27,15 @@ import {
23
27
  IconButton
24
28
  } from "./chunk-BPIYUAYS.js";
25
29
  import {
26
- NavMenuLink
27
- } from "./chunk-JA4IX7GN.js";
30
+ Label
31
+ } from "./chunk-F2AENE7H.js";
28
32
  import {
29
- NavMenuList,
30
- getPosition
31
- } from "./chunk-WSQTX34C.js";
33
+ Field,
34
+ useFieldContext
35
+ } from "./chunk-KETL4ZJK.js";
32
36
  import {
33
- NavMenu,
34
- useNavMenuContext
35
- } from "./chunk-KJUCHZHV.js";
37
+ NavMenuLink
38
+ } from "./chunk-JA4IX7GN.js";
36
39
  import {
37
40
  Show
38
41
  } from "./chunk-R4H3352X.js";
@@ -40,6 +43,7 @@ export {
40
43
  Button,
41
44
  Field,
42
45
  IconButton,
46
+ Label,
43
47
  MODE_KEY,
44
48
  NavMenu,
45
49
  NavMenuLink,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cerberus-design/react",
3
- "version": "0.1.3-next-d78e6e2",
3
+ "version": "0.1.3-next-b633e4b",
4
4
  "description": "The Cerberus Design React component library.",
5
5
  "browserslist": "> 0.25%, not dead",
6
6
  "sideEffects": false,
@@ -0,0 +1,60 @@
1
+ 'use client'
2
+
3
+ import type { HTMLAttributes, PropsWithChildren } from 'react'
4
+ import { label } from '@cerberus/styled-system/recipes'
5
+ import { css, cx } from '@cerberus/styled-system/css'
6
+ import { useFieldContext } from '../context/field'
7
+ import { Show } from './Show'
8
+ import { hstack } from '@cerberus/styled-system/patterns'
9
+
10
+ /**
11
+ * This module contains the Label component.
12
+ * @module
13
+ */
14
+
15
+ export interface LabelProps extends HTMLAttributes<HTMLLabelElement> {
16
+ htmlFor: string
17
+ hidden?: boolean
18
+ }
19
+
20
+ /**
21
+ * A screen ready friendly label component.
22
+ * @definition [ARIA Forms](https://www.a11yproject.com/checklist/#forms)
23
+ * @definition [Label docs](https://cerberus.digitalu.design/react/label)
24
+ * @example
25
+ * ```tsx
26
+ * <Field required>
27
+ * <Label htmlFor="test">Test Label</Label>
28
+ * </Field>
29
+ * ```
30
+ */
31
+ export function Label(props: PropsWithChildren<LabelProps>) {
32
+ const { hidden, ...nativeProps } = props
33
+ const { required } = useFieldContext()
34
+ const usage = hidden ? 'hidden' : 'visible'
35
+
36
+ return (
37
+ <label
38
+ {...nativeProps}
39
+ className={cx(
40
+ nativeProps.className,
41
+ label({ usage }),
42
+ hstack({
43
+ justify: 'space-between',
44
+ }),
45
+ )}
46
+ >
47
+ {props.children}
48
+ <Show when={!required}>
49
+ <span
50
+ className={css({
51
+ color: 'neutral.text.100',
52
+ fontSize: 'inherit',
53
+ })}
54
+ >
55
+ optional
56
+ </span>
57
+ </Show>
58
+ </label>
59
+ )
60
+ }
package/src/index.ts CHANGED
@@ -7,6 +7,7 @@
7
7
 
8
8
  export * from './components/Button'
9
9
  export * from './components/IconButton'
10
+ export * from './components/Label'
10
11
  export * from './components/NavMenuTrigger'
11
12
  export * from './components/NavMenuList'
12
13
  export * from './components/NavMenuLink'