@cerberus-design/react 0.5.2-next-f874d5b → 0.5.2-next-b1fa39d

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 (30) hide show
  1. package/build/legacy/_tsup-dts-rollup.d.ts +22 -2
  2. package/build/legacy/{chunk-V4SA6GNO.js → chunk-MYDNNVMZ.js} +8 -7
  3. package/build/legacy/chunk-MYDNNVMZ.js.map +1 -0
  4. package/build/legacy/{chunk-AAKHV2IO.js → chunk-SZ2JQBP4.js} +4 -4
  5. package/build/legacy/chunk-WE3JNSNO.js +33 -0
  6. package/build/legacy/chunk-WE3JNSNO.js.map +1 -0
  7. package/build/legacy/components/Input.js +2 -2
  8. package/build/legacy/components/Label.js +2 -2
  9. package/build/legacy/components/Radio.js +9 -0
  10. package/build/legacy/components/Radio.js.map +1 -0
  11. package/build/legacy/index.js +10 -6
  12. package/build/modern/_tsup-dts-rollup.d.ts +22 -2
  13. package/build/modern/{chunk-V4SA6GNO.js → chunk-MYDNNVMZ.js} +8 -7
  14. package/build/modern/chunk-MYDNNVMZ.js.map +1 -0
  15. package/build/modern/{chunk-AAKHV2IO.js → chunk-SZ2JQBP4.js} +4 -4
  16. package/build/modern/chunk-WE3JNSNO.js +33 -0
  17. package/build/modern/chunk-WE3JNSNO.js.map +1 -0
  18. package/build/modern/components/Input.js +2 -2
  19. package/build/modern/components/Label.js +2 -2
  20. package/build/modern/components/Radio.js +9 -0
  21. package/build/modern/components/Radio.js.map +1 -0
  22. package/build/modern/index.js +10 -6
  23. package/package.json +2 -2
  24. package/src/components/Label.tsx +5 -4
  25. package/src/components/Radio.tsx +35 -0
  26. package/src/index.ts +1 -0
  27. package/build/legacy/chunk-V4SA6GNO.js.map +0 -1
  28. package/build/modern/chunk-V4SA6GNO.js.map +0 -1
  29. /package/build/legacy/{chunk-AAKHV2IO.js.map → chunk-SZ2JQBP4.js.map} +0 -0
  30. /package/build/modern/{chunk-AAKHV2IO.js.map → chunk-SZ2JQBP4.js.map} +0 -0
@@ -13,9 +13,11 @@ import { JSX as JSX_2 } from 'react/jsx-runtime';
13
13
  import { label } from '@cerberus/styled-system/recipes';
14
14
  import { MutableRefObject } from 'react';
15
15
  import { PropsWithChildren } from 'react';
16
+ import { radio } from '@cerberus-design/styled-system/recipes';
16
17
  import { ReactNode } from 'react';
17
18
  import { RecipeVariantProps } from '@cerberus/styled-system/css';
18
- import type { RecipeVariantProps as RecipeVariantProps_2 } from '@cerberus/styled-system/types';
19
+ import type { RecipeVariantProps as RecipeVariantProps_2 } from '@cerberus-design/styled-system/types';
20
+ import type { RecipeVariantProps as RecipeVariantProps_3 } from '@cerberus/styled-system/types';
19
21
  import { RefObject } from 'react';
20
22
  import { tag } from '@cerberus/styled-system/recipes';
21
23
  import type { TextareaHTMLAttributes } from 'react';
@@ -315,6 +317,24 @@ declare type Positions = 'top' | 'right' | 'bottom' | 'left';
315
317
  export { Positions }
316
318
  export { Positions as Positions_alias_1 }
317
319
 
320
+ declare function Radio(props: PropsWithChildren<RadioProps>): JSX_2.Element;
321
+ export { Radio }
322
+ export { Radio as Radio_alias_1 }
323
+
324
+ declare interface RadioBaseProps extends Omit<InputHTMLAttributes<HTMLInputElement>, 'size'> {
325
+ id: string;
326
+ }
327
+ export { RadioBaseProps }
328
+ export { RadioBaseProps as RadioBaseProps_alias_1 }
329
+
330
+ declare type RadioProps = RadioBaseProps & RadioRecipe;
331
+ export { RadioProps }
332
+ export { RadioProps as RadioProps_alias_1 }
333
+
334
+ declare type RadioRecipe = RecipeVariantProps_2<typeof radio>;
335
+ export { RadioRecipe }
336
+ export { RadioRecipe as RadioRecipe_alias_1 }
337
+
318
338
  /**
319
339
  * Conditionally render its children or an optional fallback component
320
340
  * based on the SolidJS component.
@@ -484,7 +504,7 @@ export { TagProps as TagProps_alias_1 }
484
504
  * This module contains the tag component.
485
505
  * @module
486
506
  */
487
- declare type TagRecipeProps = RecipeVariantProps_2<typeof tag>;
507
+ declare type TagRecipeProps = RecipeVariantProps_3<typeof tag>;
488
508
  export { TagRecipeProps }
489
509
  export { TagRecipeProps as TagRecipeProps_alias_1 }
490
510
 
@@ -1,9 +1,9 @@
1
- import {
2
- useFieldContext
3
- } from "./chunk-ZAU4JVLL.js";
4
1
  import {
5
2
  Show
6
3
  } from "./chunk-4O4QFF4S.js";
4
+ import {
5
+ useFieldContext
6
+ } from "./chunk-ZAU4JVLL.js";
7
7
 
8
8
  // src/components/Label.tsx
9
9
  import { label } from "@cerberus/styled-system/recipes";
@@ -11,16 +11,17 @@ import { css, cx } from "@cerberus/styled-system/css";
11
11
  import { hstack } from "@cerberus/styled-system/patterns";
12
12
  import { jsx, jsxs } from "react/jsx-runtime";
13
13
  function Label(props) {
14
- const { hidden, ...nativeProps } = props;
15
- const { required } = useFieldContext();
14
+ const { hidden, size, ...nativeProps } = props;
15
+ const { required, disabled } = useFieldContext();
16
16
  const usage = hidden ? "hidden" : "visible";
17
17
  return /* @__PURE__ */ jsxs(
18
18
  "label",
19
19
  {
20
20
  ...nativeProps,
21
+ "data-disabled": disabled,
21
22
  className: cx(
22
23
  nativeProps.className,
23
- label({ usage }),
24
+ label({ size, usage }),
24
25
  hstack({
25
26
  justify: "space-between"
26
27
  })
@@ -45,4 +46,4 @@ function Label(props) {
45
46
  export {
46
47
  Label
47
48
  };
48
- //# sourceMappingURL=chunk-V4SA6GNO.js.map
49
+ //# sourceMappingURL=chunk-MYDNNVMZ.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, type RecipeVariantProps } from '@cerberus/styled-system/css'\nimport { hstack } from '@cerberus/styled-system/patterns'\nimport { useFieldContext } from '../context/field'\nimport { Show } from './Show'\n\n/**\n * This module contains the Label component.\n * @module\n */\n\nexport type LabelRecipeProps = RecipeVariantProps<typeof label>\nexport interface LabelBaseProps extends HTMLAttributes<HTMLLabelElement> {\n htmlFor: string\n hidden?: boolean\n}\nexport type LabelProps = LabelBaseProps & LabelRecipeProps\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, size, ...nativeProps } = props\n const { required, disabled } = useFieldContext()\n const usage = hidden ? 'hidden' : 'visible'\n\n return (\n <label\n {...nativeProps}\n data-disabled={disabled}\n className={cx(\n nativeProps.className,\n label({ size, 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,UAAmC;AACjD,SAAS,cAAc;AAiCnB,SAaI,KAbJ;AANG,SAAS,MAAM,OAAsC;AAC1D,QAAM,EAAE,QAAQ,MAAM,GAAG,YAAY,IAAI;AACzC,QAAM,EAAE,UAAU,SAAS,IAAI,gBAAgB;AAC/C,QAAM,QAAQ,SAAS,WAAW;AAElC,SACE;AAAA,IAAC;AAAA;AAAA,MACE,GAAG;AAAA,MACJ,iBAAe;AAAA,MACf,WAAW;AAAA,QACT,YAAY;AAAA,QACZ,MAAM,EAAE,MAAM,MAAM,CAAC;AAAA,QACrB,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":[]}
@@ -1,9 +1,9 @@
1
- import {
2
- useFieldContext
3
- } from "./chunk-ZAU4JVLL.js";
4
1
  import {
5
2
  Show
6
3
  } from "./chunk-4O4QFF4S.js";
4
+ import {
5
+ useFieldContext
6
+ } from "./chunk-ZAU4JVLL.js";
7
7
  import {
8
8
  $cerberusIcons
9
9
  } from "./chunk-LQD23PG3.js";
@@ -39,4 +39,4 @@ function Input(props) {
39
39
  export {
40
40
  Input
41
41
  };
42
- //# sourceMappingURL=chunk-AAKHV2IO.js.map
42
+ //# sourceMappingURL=chunk-SZ2JQBP4.js.map
@@ -0,0 +1,33 @@
1
+ import {
2
+ useFieldContext
3
+ } from "./chunk-ZAU4JVLL.js";
4
+
5
+ // src/components/Radio.tsx
6
+ import { cx } from "@cerberus-design/styled-system/css";
7
+ import { hstack } from "@cerberus-design/styled-system/patterns";
8
+ import { radio } from "@cerberus-design/styled-system/recipes";
9
+ import { jsx, jsxs } from "react/jsx-runtime";
10
+ function Radio(props) {
11
+ const { children, size, ...nativeProps } = props;
12
+ const { invalid, ...state } = useFieldContext();
13
+ const styles = radio({ size });
14
+ return /* @__PURE__ */ jsxs("div", { className: cx("group", hstack(), styles.root), tabIndex: 0, children: [
15
+ /* @__PURE__ */ jsx(
16
+ "input",
17
+ {
18
+ ...nativeProps,
19
+ ...state,
20
+ ...invalid && { "aria-invalid": true },
21
+ className: cx(nativeProps.className, styles.input),
22
+ tabIndex: -1,
23
+ type: "radio"
24
+ }
25
+ ),
26
+ children
27
+ ] });
28
+ }
29
+
30
+ export {
31
+ Radio
32
+ };
33
+ //# sourceMappingURL=chunk-WE3JNSNO.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/components/Radio.tsx"],"sourcesContent":["'use client'\n\nimport { cx } from '@cerberus-design/styled-system/css'\nimport { hstack } from '@cerberus-design/styled-system/patterns'\nimport { radio } from '@cerberus-design/styled-system/recipes'\nimport type { RecipeVariantProps } from '@cerberus-design/styled-system/types'\nimport type { InputHTMLAttributes, PropsWithChildren } from 'react'\nimport { useFieldContext } from '../context/field'\n\nexport type RadioRecipe = RecipeVariantProps<typeof radio>\nexport interface RadioBaseProps\n extends Omit<InputHTMLAttributes<HTMLInputElement>, 'size'> {\n id: string\n}\nexport type RadioProps = RadioBaseProps & RadioRecipe\n\nexport function Radio(props: PropsWithChildren<RadioProps>) {\n const { children, size, ...nativeProps } = props\n const { invalid, ...state } = useFieldContext()\n const styles = radio({ size })\n\n return (\n <div className={cx('group', hstack(), styles.root)} tabIndex={0}>\n <input\n {...nativeProps}\n {...state}\n {...(invalid && { 'aria-invalid': true })}\n className={cx(nativeProps.className, styles.input)}\n tabIndex={-1}\n type=\"radio\"\n />\n {children}\n </div>\n )\n}\n"],"mappings":";;;;;AAEA,SAAS,UAAU;AACnB,SAAS,cAAc;AACvB,SAAS,aAAa;AAkBlB,SACE,KADF;AANG,SAAS,MAAM,OAAsC;AAC1D,QAAM,EAAE,UAAU,MAAM,GAAG,YAAY,IAAI;AAC3C,QAAM,EAAE,SAAS,GAAG,MAAM,IAAI,gBAAgB;AAC9C,QAAM,SAAS,MAAM,EAAE,KAAK,CAAC;AAE7B,SACE,qBAAC,SAAI,WAAW,GAAG,SAAS,OAAO,GAAG,OAAO,IAAI,GAAG,UAAU,GAC5D;AAAA;AAAA,MAAC;AAAA;AAAA,QACE,GAAG;AAAA,QACH,GAAG;AAAA,QACH,GAAI,WAAW,EAAE,gBAAgB,KAAK;AAAA,QACvC,WAAW,GAAG,YAAY,WAAW,OAAO,KAAK;AAAA,QACjD,UAAU;AAAA,QACV,MAAK;AAAA;AAAA,IACP;AAAA,IACC;AAAA,KACH;AAEJ;","names":[]}
@@ -1,9 +1,9 @@
1
1
  "use client";
2
2
  import {
3
3
  Input
4
- } from "../chunk-AAKHV2IO.js";
5
- import "../chunk-ZAU4JVLL.js";
4
+ } from "../chunk-SZ2JQBP4.js";
6
5
  import "../chunk-4O4QFF4S.js";
6
+ import "../chunk-ZAU4JVLL.js";
7
7
  import "../chunk-LQD23PG3.js";
8
8
  import "../chunk-RK5HK6UU.js";
9
9
  export {
@@ -1,9 +1,9 @@
1
1
  "use client";
2
2
  import {
3
3
  Label
4
- } from "../chunk-V4SA6GNO.js";
5
- import "../chunk-ZAU4JVLL.js";
4
+ } from "../chunk-MYDNNVMZ.js";
6
5
  import "../chunk-4O4QFF4S.js";
6
+ import "../chunk-ZAU4JVLL.js";
7
7
  export {
8
8
  Label
9
9
  };
@@ -0,0 +1,9 @@
1
+ "use client";
2
+ import {
3
+ Radio
4
+ } from "../chunk-WE3JNSNO.js";
5
+ import "../chunk-ZAU4JVLL.js";
6
+ export {
7
+ Radio
8
+ };
9
+ //# sourceMappingURL=Radio.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
@@ -21,14 +21,10 @@ import {
21
21
  } from "./chunk-SLHX5K6I.js";
22
22
  import {
23
23
  Input
24
- } from "./chunk-AAKHV2IO.js";
24
+ } from "./chunk-SZ2JQBP4.js";
25
25
  import {
26
26
  Label
27
- } from "./chunk-V4SA6GNO.js";
28
- import {
29
- Field,
30
- useFieldContext
31
- } from "./chunk-ZAU4JVLL.js";
27
+ } from "./chunk-MYDNNVMZ.js";
32
28
  import {
33
29
  NavMenuLink
34
30
  } from "./chunk-6DIGPXAD.js";
@@ -46,6 +42,13 @@ import {
46
42
  import {
47
43
  Show
48
44
  } from "./chunk-4O4QFF4S.js";
45
+ import {
46
+ Radio
47
+ } from "./chunk-WE3JNSNO.js";
48
+ import {
49
+ Field,
50
+ useFieldContext
51
+ } from "./chunk-ZAU4JVLL.js";
49
52
  import "./chunk-55J6XMHW.js";
50
53
  import {
51
54
  createNavTriggerProps
@@ -86,6 +89,7 @@ export {
86
89
  NavMenuLink,
87
90
  NavMenuList,
88
91
  NavMenuTrigger,
92
+ Radio,
89
93
  Show,
90
94
  THEME_KEY,
91
95
  Tab,
@@ -13,9 +13,11 @@ import { JSX as JSX_2 } from 'react/jsx-runtime';
13
13
  import { label } from '@cerberus/styled-system/recipes';
14
14
  import { MutableRefObject } from 'react';
15
15
  import { PropsWithChildren } from 'react';
16
+ import { radio } from '@cerberus-design/styled-system/recipes';
16
17
  import { ReactNode } from 'react';
17
18
  import { RecipeVariantProps } from '@cerberus/styled-system/css';
18
- import type { RecipeVariantProps as RecipeVariantProps_2 } from '@cerberus/styled-system/types';
19
+ import type { RecipeVariantProps as RecipeVariantProps_2 } from '@cerberus-design/styled-system/types';
20
+ import type { RecipeVariantProps as RecipeVariantProps_3 } from '@cerberus/styled-system/types';
19
21
  import { RefObject } from 'react';
20
22
  import { tag } from '@cerberus/styled-system/recipes';
21
23
  import type { TextareaHTMLAttributes } from 'react';
@@ -315,6 +317,24 @@ declare type Positions = 'top' | 'right' | 'bottom' | 'left';
315
317
  export { Positions }
316
318
  export { Positions as Positions_alias_1 }
317
319
 
320
+ declare function Radio(props: PropsWithChildren<RadioProps>): JSX_2.Element;
321
+ export { Radio }
322
+ export { Radio as Radio_alias_1 }
323
+
324
+ declare interface RadioBaseProps extends Omit<InputHTMLAttributes<HTMLInputElement>, 'size'> {
325
+ id: string;
326
+ }
327
+ export { RadioBaseProps }
328
+ export { RadioBaseProps as RadioBaseProps_alias_1 }
329
+
330
+ declare type RadioProps = RadioBaseProps & RadioRecipe;
331
+ export { RadioProps }
332
+ export { RadioProps as RadioProps_alias_1 }
333
+
334
+ declare type RadioRecipe = RecipeVariantProps_2<typeof radio>;
335
+ export { RadioRecipe }
336
+ export { RadioRecipe as RadioRecipe_alias_1 }
337
+
318
338
  /**
319
339
  * Conditionally render its children or an optional fallback component
320
340
  * based on the SolidJS component.
@@ -484,7 +504,7 @@ export { TagProps as TagProps_alias_1 }
484
504
  * This module contains the tag component.
485
505
  * @module
486
506
  */
487
- declare type TagRecipeProps = RecipeVariantProps_2<typeof tag>;
507
+ declare type TagRecipeProps = RecipeVariantProps_3<typeof tag>;
488
508
  export { TagRecipeProps }
489
509
  export { TagRecipeProps as TagRecipeProps_alias_1 }
490
510
 
@@ -1,9 +1,9 @@
1
- import {
2
- useFieldContext
3
- } from "./chunk-ZAU4JVLL.js";
4
1
  import {
5
2
  Show
6
3
  } from "./chunk-4O4QFF4S.js";
4
+ import {
5
+ useFieldContext
6
+ } from "./chunk-ZAU4JVLL.js";
7
7
 
8
8
  // src/components/Label.tsx
9
9
  import { label } from "@cerberus/styled-system/recipes";
@@ -11,16 +11,17 @@ import { css, cx } from "@cerberus/styled-system/css";
11
11
  import { hstack } from "@cerberus/styled-system/patterns";
12
12
  import { jsx, jsxs } from "react/jsx-runtime";
13
13
  function Label(props) {
14
- const { hidden, ...nativeProps } = props;
15
- const { required } = useFieldContext();
14
+ const { hidden, size, ...nativeProps } = props;
15
+ const { required, disabled } = useFieldContext();
16
16
  const usage = hidden ? "hidden" : "visible";
17
17
  return /* @__PURE__ */ jsxs(
18
18
  "label",
19
19
  {
20
20
  ...nativeProps,
21
+ "data-disabled": disabled,
21
22
  className: cx(
22
23
  nativeProps.className,
23
- label({ usage }),
24
+ label({ size, usage }),
24
25
  hstack({
25
26
  justify: "space-between"
26
27
  })
@@ -45,4 +46,4 @@ function Label(props) {
45
46
  export {
46
47
  Label
47
48
  };
48
- //# sourceMappingURL=chunk-V4SA6GNO.js.map
49
+ //# sourceMappingURL=chunk-MYDNNVMZ.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, type RecipeVariantProps } from '@cerberus/styled-system/css'\nimport { hstack } from '@cerberus/styled-system/patterns'\nimport { useFieldContext } from '../context/field'\nimport { Show } from './Show'\n\n/**\n * This module contains the Label component.\n * @module\n */\n\nexport type LabelRecipeProps = RecipeVariantProps<typeof label>\nexport interface LabelBaseProps extends HTMLAttributes<HTMLLabelElement> {\n htmlFor: string\n hidden?: boolean\n}\nexport type LabelProps = LabelBaseProps & LabelRecipeProps\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, size, ...nativeProps } = props\n const { required, disabled } = useFieldContext()\n const usage = hidden ? 'hidden' : 'visible'\n\n return (\n <label\n {...nativeProps}\n data-disabled={disabled}\n className={cx(\n nativeProps.className,\n label({ size, 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,UAAmC;AACjD,SAAS,cAAc;AAiCnB,SAaI,KAbJ;AANG,SAAS,MAAM,OAAsC;AAC1D,QAAM,EAAE,QAAQ,MAAM,GAAG,YAAY,IAAI;AACzC,QAAM,EAAE,UAAU,SAAS,IAAI,gBAAgB;AAC/C,QAAM,QAAQ,SAAS,WAAW;AAElC,SACE;AAAA,IAAC;AAAA;AAAA,MACE,GAAG;AAAA,MACJ,iBAAe;AAAA,MACf,WAAW;AAAA,QACT,YAAY;AAAA,QACZ,MAAM,EAAE,MAAM,MAAM,CAAC;AAAA,QACrB,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":[]}
@@ -1,9 +1,9 @@
1
- import {
2
- useFieldContext
3
- } from "./chunk-ZAU4JVLL.js";
4
1
  import {
5
2
  Show
6
3
  } from "./chunk-4O4QFF4S.js";
4
+ import {
5
+ useFieldContext
6
+ } from "./chunk-ZAU4JVLL.js";
7
7
  import {
8
8
  $cerberusIcons
9
9
  } from "./chunk-LQD23PG3.js";
@@ -39,4 +39,4 @@ function Input(props) {
39
39
  export {
40
40
  Input
41
41
  };
42
- //# sourceMappingURL=chunk-AAKHV2IO.js.map
42
+ //# sourceMappingURL=chunk-SZ2JQBP4.js.map
@@ -0,0 +1,33 @@
1
+ import {
2
+ useFieldContext
3
+ } from "./chunk-ZAU4JVLL.js";
4
+
5
+ // src/components/Radio.tsx
6
+ import { cx } from "@cerberus-design/styled-system/css";
7
+ import { hstack } from "@cerberus-design/styled-system/patterns";
8
+ import { radio } from "@cerberus-design/styled-system/recipes";
9
+ import { jsx, jsxs } from "react/jsx-runtime";
10
+ function Radio(props) {
11
+ const { children, size, ...nativeProps } = props;
12
+ const { invalid, ...state } = useFieldContext();
13
+ const styles = radio({ size });
14
+ return /* @__PURE__ */ jsxs("div", { className: cx("group", hstack(), styles.root), tabIndex: 0, children: [
15
+ /* @__PURE__ */ jsx(
16
+ "input",
17
+ {
18
+ ...nativeProps,
19
+ ...state,
20
+ ...invalid && { "aria-invalid": true },
21
+ className: cx(nativeProps.className, styles.input),
22
+ tabIndex: -1,
23
+ type: "radio"
24
+ }
25
+ ),
26
+ children
27
+ ] });
28
+ }
29
+
30
+ export {
31
+ Radio
32
+ };
33
+ //# sourceMappingURL=chunk-WE3JNSNO.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/components/Radio.tsx"],"sourcesContent":["'use client'\n\nimport { cx } from '@cerberus-design/styled-system/css'\nimport { hstack } from '@cerberus-design/styled-system/patterns'\nimport { radio } from '@cerberus-design/styled-system/recipes'\nimport type { RecipeVariantProps } from '@cerberus-design/styled-system/types'\nimport type { InputHTMLAttributes, PropsWithChildren } from 'react'\nimport { useFieldContext } from '../context/field'\n\nexport type RadioRecipe = RecipeVariantProps<typeof radio>\nexport interface RadioBaseProps\n extends Omit<InputHTMLAttributes<HTMLInputElement>, 'size'> {\n id: string\n}\nexport type RadioProps = RadioBaseProps & RadioRecipe\n\nexport function Radio(props: PropsWithChildren<RadioProps>) {\n const { children, size, ...nativeProps } = props\n const { invalid, ...state } = useFieldContext()\n const styles = radio({ size })\n\n return (\n <div className={cx('group', hstack(), styles.root)} tabIndex={0}>\n <input\n {...nativeProps}\n {...state}\n {...(invalid && { 'aria-invalid': true })}\n className={cx(nativeProps.className, styles.input)}\n tabIndex={-1}\n type=\"radio\"\n />\n {children}\n </div>\n )\n}\n"],"mappings":";;;;;AAEA,SAAS,UAAU;AACnB,SAAS,cAAc;AACvB,SAAS,aAAa;AAkBlB,SACE,KADF;AANG,SAAS,MAAM,OAAsC;AAC1D,QAAM,EAAE,UAAU,MAAM,GAAG,YAAY,IAAI;AAC3C,QAAM,EAAE,SAAS,GAAG,MAAM,IAAI,gBAAgB;AAC9C,QAAM,SAAS,MAAM,EAAE,KAAK,CAAC;AAE7B,SACE,qBAAC,SAAI,WAAW,GAAG,SAAS,OAAO,GAAG,OAAO,IAAI,GAAG,UAAU,GAC5D;AAAA;AAAA,MAAC;AAAA;AAAA,QACE,GAAG;AAAA,QACH,GAAG;AAAA,QACH,GAAI,WAAW,EAAE,gBAAgB,KAAK;AAAA,QACvC,WAAW,GAAG,YAAY,WAAW,OAAO,KAAK;AAAA,QACjD,UAAU;AAAA,QACV,MAAK;AAAA;AAAA,IACP;AAAA,IACC;AAAA,KACH;AAEJ;","names":[]}
@@ -1,9 +1,9 @@
1
1
  "use client";
2
2
  import {
3
3
  Input
4
- } from "../chunk-AAKHV2IO.js";
5
- import "../chunk-ZAU4JVLL.js";
4
+ } from "../chunk-SZ2JQBP4.js";
6
5
  import "../chunk-4O4QFF4S.js";
6
+ import "../chunk-ZAU4JVLL.js";
7
7
  import "../chunk-LQD23PG3.js";
8
8
  import "../chunk-RK5HK6UU.js";
9
9
  export {
@@ -1,9 +1,9 @@
1
1
  "use client";
2
2
  import {
3
3
  Label
4
- } from "../chunk-V4SA6GNO.js";
5
- import "../chunk-ZAU4JVLL.js";
4
+ } from "../chunk-MYDNNVMZ.js";
6
5
  import "../chunk-4O4QFF4S.js";
6
+ import "../chunk-ZAU4JVLL.js";
7
7
  export {
8
8
  Label
9
9
  };
@@ -0,0 +1,9 @@
1
+ "use client";
2
+ import {
3
+ Radio
4
+ } from "../chunk-WE3JNSNO.js";
5
+ import "../chunk-ZAU4JVLL.js";
6
+ export {
7
+ Radio
8
+ };
9
+ //# sourceMappingURL=Radio.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
@@ -21,14 +21,10 @@ import {
21
21
  } from "./chunk-SLHX5K6I.js";
22
22
  import {
23
23
  Input
24
- } from "./chunk-AAKHV2IO.js";
24
+ } from "./chunk-SZ2JQBP4.js";
25
25
  import {
26
26
  Label
27
- } from "./chunk-V4SA6GNO.js";
28
- import {
29
- Field,
30
- useFieldContext
31
- } from "./chunk-ZAU4JVLL.js";
27
+ } from "./chunk-MYDNNVMZ.js";
32
28
  import {
33
29
  NavMenuLink
34
30
  } from "./chunk-6DIGPXAD.js";
@@ -46,6 +42,13 @@ import {
46
42
  import {
47
43
  Show
48
44
  } from "./chunk-4O4QFF4S.js";
45
+ import {
46
+ Radio
47
+ } from "./chunk-WE3JNSNO.js";
48
+ import {
49
+ Field,
50
+ useFieldContext
51
+ } from "./chunk-ZAU4JVLL.js";
49
52
  import "./chunk-55J6XMHW.js";
50
53
  import {
51
54
  createNavTriggerProps
@@ -86,6 +89,7 @@ export {
86
89
  NavMenuLink,
87
90
  NavMenuList,
88
91
  NavMenuTrigger,
92
+ Radio,
89
93
  Show,
90
94
  THEME_KEY,
91
95
  Tab,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cerberus-design/react",
3
- "version": "0.5.2-next-f874d5b",
3
+ "version": "0.5.2-next-b1fa39d",
4
4
  "description": "The Cerberus Design React component library.",
5
5
  "browserslist": "> 0.25%, not dead",
6
6
  "sideEffects": false,
@@ -22,7 +22,7 @@
22
22
  "react-dom": "^18",
23
23
  "tsup": "^8.1.0",
24
24
  "@cerberus-design/configs": "0.0.0",
25
- "@cerberus-design/styled-system": "0.5.2-next-f874d5b"
25
+ "@cerberus-design/styled-system": "0.5.2-next-b1fa39d"
26
26
  },
27
27
  "publishConfig": {
28
28
  "access": "public"
@@ -3,9 +3,9 @@
3
3
  import type { HTMLAttributes, PropsWithChildren } from 'react'
4
4
  import { label } from '@cerberus/styled-system/recipes'
5
5
  import { css, cx, type RecipeVariantProps } from '@cerberus/styled-system/css'
6
+ import { hstack } from '@cerberus/styled-system/patterns'
6
7
  import { useFieldContext } from '../context/field'
7
8
  import { Show } from './Show'
8
- import { hstack } from '@cerberus/styled-system/patterns'
9
9
 
10
10
  /**
11
11
  * This module contains the Label component.
@@ -31,16 +31,17 @@ export type LabelProps = LabelBaseProps & LabelRecipeProps
31
31
  * ```
32
32
  */
33
33
  export function Label(props: PropsWithChildren<LabelProps>) {
34
- const { hidden, ...nativeProps } = props
35
- const { required } = useFieldContext()
34
+ const { hidden, size, ...nativeProps } = props
35
+ const { required, disabled } = useFieldContext()
36
36
  const usage = hidden ? 'hidden' : 'visible'
37
37
 
38
38
  return (
39
39
  <label
40
40
  {...nativeProps}
41
+ data-disabled={disabled}
41
42
  className={cx(
42
43
  nativeProps.className,
43
- label({ usage }),
44
+ label({ size, usage }),
44
45
  hstack({
45
46
  justify: 'space-between',
46
47
  }),
@@ -0,0 +1,35 @@
1
+ 'use client'
2
+
3
+ import { cx } from '@cerberus-design/styled-system/css'
4
+ import { hstack } from '@cerberus-design/styled-system/patterns'
5
+ import { radio } from '@cerberus-design/styled-system/recipes'
6
+ import type { RecipeVariantProps } from '@cerberus-design/styled-system/types'
7
+ import type { InputHTMLAttributes, PropsWithChildren } from 'react'
8
+ import { useFieldContext } from '../context/field'
9
+
10
+ export type RadioRecipe = RecipeVariantProps<typeof radio>
11
+ export interface RadioBaseProps
12
+ extends Omit<InputHTMLAttributes<HTMLInputElement>, 'size'> {
13
+ id: string
14
+ }
15
+ export type RadioProps = RadioBaseProps & RadioRecipe
16
+
17
+ export function Radio(props: PropsWithChildren<RadioProps>) {
18
+ const { children, size, ...nativeProps } = props
19
+ const { invalid, ...state } = useFieldContext()
20
+ const styles = radio({ size })
21
+
22
+ return (
23
+ <div className={cx('group', hstack(), styles.root)} tabIndex={0}>
24
+ <input
25
+ {...nativeProps}
26
+ {...state}
27
+ {...(invalid && { 'aria-invalid': true })}
28
+ className={cx(nativeProps.className, styles.input)}
29
+ tabIndex={-1}
30
+ type="radio"
31
+ />
32
+ {children}
33
+ </div>
34
+ )
35
+ }
package/src/index.ts CHANGED
@@ -13,6 +13,7 @@ export * from './components/Label'
13
13
  export * from './components/NavMenuTrigger'
14
14
  export * from './components/NavMenuList'
15
15
  export * from './components/NavMenuLink'
16
+ export * from './components/Radio'
16
17
  export * from './components/Tab'
17
18
  export * from './components/TabList'
18
19
  export * from './components/TabPanel'
@@ -1 +0,0 @@
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, type RecipeVariantProps } 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 type LabelRecipeProps = RecipeVariantProps<typeof label>\nexport interface LabelBaseProps extends HTMLAttributes<HTMLLabelElement> {\n htmlFor: string\n hidden?: boolean\n}\nexport type LabelProps = LabelBaseProps & LabelRecipeProps\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,UAAmC;AAGjD,SAAS,cAAc;AA+BnB,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":[]}
@@ -1 +0,0 @@
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, type RecipeVariantProps } 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 type LabelRecipeProps = RecipeVariantProps<typeof label>\nexport interface LabelBaseProps extends HTMLAttributes<HTMLLabelElement> {\n htmlFor: string\n hidden?: boolean\n}\nexport type LabelProps = LabelBaseProps & LabelRecipeProps\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,UAAmC;AAGjD,SAAS,cAAc;AA+BnB,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":[]}