@cerberus-design/react 0.1.3-next-cb1c11b → 0.1.3-next-59f45d9

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 (38) hide show
  1. package/build/legacy/_tsup-dts-rollup.d.ts +14 -1
  2. package/build/legacy/chunk-LD5ZV46F.js +35 -0
  3. package/build/legacy/chunk-LD5ZV46F.js.map +1 -0
  4. package/build/{modern/chunk-EYZ3S36P.js → legacy/chunk-OXVNTE4A.js} +2 -2
  5. package/build/legacy/{chunk-6VY34K3P.js → chunk-YVUZSAJG.js} +2 -2
  6. package/build/legacy/{chunk-KETL4ZJK.js → chunk-ZAU4JVLL.js} +3 -3
  7. package/build/legacy/{chunk-KETL4ZJK.js.map → chunk-ZAU4JVLL.js.map} +1 -1
  8. package/build/legacy/components/FieldMessage.js +2 -2
  9. package/build/legacy/components/Input.d.ts +2 -0
  10. package/build/legacy/components/Input.js +10 -0
  11. package/build/legacy/components/Input.js.map +1 -0
  12. package/build/legacy/components/Label.js +2 -2
  13. package/build/legacy/context/field.js +1 -1
  14. package/build/legacy/index.d.ts +2 -0
  15. package/build/legacy/index.js +8 -4
  16. package/build/modern/_tsup-dts-rollup.d.ts +14 -1
  17. package/build/modern/chunk-LD5ZV46F.js +35 -0
  18. package/build/modern/chunk-LD5ZV46F.js.map +1 -0
  19. package/build/{legacy/chunk-EYZ3S36P.js → modern/chunk-OXVNTE4A.js} +2 -2
  20. package/build/modern/{chunk-6VY34K3P.js → chunk-YVUZSAJG.js} +2 -2
  21. package/build/modern/{chunk-KETL4ZJK.js → chunk-ZAU4JVLL.js} +3 -3
  22. package/build/modern/{chunk-KETL4ZJK.js.map → chunk-ZAU4JVLL.js.map} +1 -1
  23. package/build/modern/components/FieldMessage.js +2 -2
  24. package/build/modern/components/Input.d.ts +2 -0
  25. package/build/modern/components/Input.js +10 -0
  26. package/build/modern/components/Input.js.map +1 -0
  27. package/build/modern/components/Label.js +2 -2
  28. package/build/modern/context/field.js +1 -1
  29. package/build/modern/index.d.ts +2 -0
  30. package/build/modern/index.js +8 -4
  31. package/package.json +2 -1
  32. package/src/components/Input.tsx +36 -0
  33. package/src/context/field.tsx +3 -3
  34. package/src/index.ts +1 -0
  35. /package/build/legacy/{chunk-EYZ3S36P.js.map → chunk-OXVNTE4A.js.map} +0 -0
  36. /package/build/legacy/{chunk-6VY34K3P.js.map → chunk-YVUZSAJG.js.map} +0 -0
  37. /package/build/modern/{chunk-EYZ3S36P.js.map → chunk-OXVNTE4A.js.map} +0 -0
  38. /package/build/modern/{chunk-6VY34K3P.js.map → chunk-YVUZSAJG.js.map} +0 -0
@@ -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 type { InputHTMLAttributes } from 'react';
5
6
  import { JSX as JSX_2 } from 'react/jsx-runtime';
6
7
  import { PropsWithChildren } from 'react';
7
8
  import { ReactNode } from 'react';
@@ -49,7 +50,7 @@ export { Field as Field_alias_1 }
49
50
 
50
51
  declare interface FieldContextValue {
51
52
  disabled?: boolean;
52
- readonly?: boolean;
53
+ readOnly?: boolean;
53
54
  required?: boolean;
54
55
  invalid?: boolean;
55
56
  }
@@ -120,6 +121,18 @@ declare type IconButtonUsage = Exclude<ButtonProps['usage'], 'outline'>;
120
121
  export { IconButtonUsage }
121
122
  export { IconButtonUsage as IconButtonUsage_alias_1 }
122
123
 
124
+ declare function Input(props: InputProps): JSX_2.Element;
125
+ export { Input }
126
+ export { Input as Input_alias_1 }
127
+
128
+ declare interface InputProps extends Omit<InputHTMLAttributes<HTMLInputElement>, 'id' | 'size'> {
129
+ describedBy?: string;
130
+ id: string;
131
+ size?: 'sm' | 'md' | 'lg';
132
+ }
133
+ export { InputProps }
134
+ export { InputProps as InputProps_alias_1 }
135
+
123
136
  /**
124
137
  * A screen ready friendly label component.
125
138
  * @definition [ARIA Forms](https://www.a11yproject.com/checklist/#forms)
@@ -0,0 +1,35 @@
1
+ import {
2
+ Show
3
+ } from "./chunk-R4H3352X.js";
4
+ import {
5
+ useFieldContext
6
+ } from "./chunk-ZAU4JVLL.js";
7
+
8
+ // src/components/Input.tsx
9
+ import { WarningFilled } from "@cerberus/icons";
10
+ import { input } from "@cerberus/styled-system/recipes";
11
+ import { cx } from "@cerberus/styled-system/css";
12
+ import { jsx, jsxs } from "react/jsx-runtime";
13
+ function Input(props) {
14
+ const { describedBy, size, ...nativeProps } = props;
15
+ const inputStyles = input({ size });
16
+ const { invalid, ...fieldStates } = useFieldContext();
17
+ return /* @__PURE__ */ jsxs("div", { className: inputStyles.root, children: [
18
+ /* @__PURE__ */ jsx(
19
+ "input",
20
+ {
21
+ ...nativeProps,
22
+ ...fieldStates,
23
+ ...describedBy && { "aria-describedby": describedBy },
24
+ ...invalid && { "aria-invalid": true },
25
+ className: cx("peer", nativeProps.className, inputStyles.input)
26
+ }
27
+ ),
28
+ /* @__PURE__ */ jsx(Show, { when: invalid, children: /* @__PURE__ */ jsx(WarningFilled, { className: inputStyles.icon }) })
29
+ ] });
30
+ }
31
+
32
+ export {
33
+ Input
34
+ };
35
+ //# sourceMappingURL=chunk-LD5ZV46F.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/components/Input.tsx"],"sourcesContent":["'use client'\n\nimport type { InputHTMLAttributes } from 'react'\nimport { WarningFilled } from '@cerberus/icons'\nimport { input } from '@cerberus/styled-system/recipes'\nimport { cx } from '@cerberus/styled-system/css'\nimport { useFieldContext } from '../context/field'\nimport { Show } from './Show'\n\nexport interface InputProps\n extends Omit<InputHTMLAttributes<HTMLInputElement>, 'id' | 'size'> {\n describedBy?: string\n id: string\n size?: 'sm' | 'md' | 'lg'\n}\n\nexport function Input(props: InputProps) {\n const { describedBy, size, ...nativeProps } = props\n const inputStyles = input({ size })\n const { invalid, ...fieldStates } = useFieldContext()\n\n return (\n <div className={inputStyles.root}>\n <input\n {...nativeProps}\n {...fieldStates}\n {...(describedBy && { 'aria-describedby': describedBy })}\n {...(invalid && { 'aria-invalid': true })}\n className={cx('peer', nativeProps.className, inputStyles.input)}\n />\n <Show when={invalid}>\n <WarningFilled className={inputStyles.icon} />\n </Show>\n </div>\n )\n}\n"],"mappings":";;;;;;;;AAGA,SAAS,qBAAqB;AAC9B,SAAS,aAAa;AACtB,SAAS,UAAU;AAiBf,SACE,KADF;AANG,SAAS,MAAM,OAAmB;AACvC,QAAM,EAAE,aAAa,MAAM,GAAG,YAAY,IAAI;AAC9C,QAAM,cAAc,MAAM,EAAE,KAAK,CAAC;AAClC,QAAM,EAAE,SAAS,GAAG,YAAY,IAAI,gBAAgB;AAEpD,SACE,qBAAC,SAAI,WAAW,YAAY,MAC1B;AAAA;AAAA,MAAC;AAAA;AAAA,QACE,GAAG;AAAA,QACH,GAAG;AAAA,QACH,GAAI,eAAe,EAAE,oBAAoB,YAAY;AAAA,QACrD,GAAI,WAAW,EAAE,gBAAgB,KAAK;AAAA,QACvC,WAAW,GAAG,QAAQ,YAAY,WAAW,YAAY,KAAK;AAAA;AAAA,IAChE;AAAA,IACA,oBAAC,QAAK,MAAM,SACV,8BAAC,iBAAc,WAAW,YAAY,MAAM,GAC9C;AAAA,KACF;AAEJ;","names":[]}
@@ -3,7 +3,7 @@ import {
3
3
  } from "./chunk-R4H3352X.js";
4
4
  import {
5
5
  useFieldContext
6
- } from "./chunk-KETL4ZJK.js";
6
+ } from "./chunk-ZAU4JVLL.js";
7
7
 
8
8
  // src/components/Label.tsx
9
9
  import { label } from "@cerberus/styled-system/recipes";
@@ -45,4 +45,4 @@ function Label(props) {
45
45
  export {
46
46
  Label
47
47
  };
48
- //# sourceMappingURL=chunk-EYZ3S36P.js.map
48
+ //# sourceMappingURL=chunk-OXVNTE4A.js.map
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  useFieldContext
3
- } from "./chunk-KETL4ZJK.js";
3
+ } from "./chunk-ZAU4JVLL.js";
4
4
 
5
5
  // src/components/FieldMessage.tsx
6
6
  import { cx } from "@cerberus/styled-system/css";
@@ -21,4 +21,4 @@ function FieldMessage(props) {
21
21
  export {
22
22
  FieldMessage
23
23
  };
24
- //# sourceMappingURL=chunk-6VY34K3P.js.map
24
+ //# sourceMappingURL=chunk-YVUZSAJG.js.map
@@ -10,11 +10,11 @@ function Field(props) {
10
10
  const value = useMemo(
11
11
  () => ({
12
12
  disabled: props.disabled,
13
- readonly: props.readonly,
13
+ readOnly: props.readOnly,
14
14
  required: props.required,
15
15
  invalid: props.invalid
16
16
  }),
17
- [props.disabled, props.readonly, props.required, props.invalid]
17
+ [props.disabled, props.readOnly, props.required, props.invalid]
18
18
  );
19
19
  return /* @__PURE__ */ jsx(FieldContext.Provider, { value, children: props.children });
20
20
  }
@@ -30,4 +30,4 @@ export {
30
30
  Field,
31
31
  useFieldContext
32
32
  };
33
- //# sourceMappingURL=chunk-KETL4ZJK.js.map
33
+ //# sourceMappingURL=chunk-ZAU4JVLL.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/context/field.tsx"],"sourcesContent":["'use client'\n\nimport {\n createContext,\n useContext,\n useMemo,\n type PropsWithChildren,\n} from 'react'\n\nexport interface FieldContextValue {\n disabled?: boolean\n readonly?: boolean\n required?: boolean\n invalid?: boolean\n}\n\nconst FieldContext = createContext<FieldContextValue | null>(null)\n\nexport function Field(\n props: PropsWithChildren<FieldContextValue>,\n): JSX.Element {\n const value = useMemo(\n () => ({\n disabled: props.disabled,\n readonly: props.readonly,\n required: props.required,\n invalid: props.invalid,\n }),\n [props.disabled, props.readonly, props.required, props.invalid],\n )\n\n return (\n <FieldContext.Provider value={value}>\n {props.children}\n </FieldContext.Provider>\n )\n}\n\nexport function useFieldContext(): FieldContextValue {\n const context = useContext(FieldContext)\n if (!context) {\n throw new Error('useFieldContext must be used within a Field Provider.')\n }\n return context\n}\n"],"mappings":";AAEA;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,OAEK;AAyBH;AAhBJ,IAAM,eAAe,cAAwC,IAAI;AAE1D,SAAS,MACd,OACa;AACb,QAAM,QAAQ;AAAA,IACZ,OAAO;AAAA,MACL,UAAU,MAAM;AAAA,MAChB,UAAU,MAAM;AAAA,MAChB,UAAU,MAAM;AAAA,MAChB,SAAS,MAAM;AAAA,IACjB;AAAA,IACA,CAAC,MAAM,UAAU,MAAM,UAAU,MAAM,UAAU,MAAM,OAAO;AAAA,EAChE;AAEA,SACE,oBAAC,aAAa,UAAb,EAAsB,OACpB,gBAAM,UACT;AAEJ;AAEO,SAAS,kBAAqC;AACnD,QAAM,UAAU,WAAW,YAAY;AACvC,MAAI,CAAC,SAAS;AACZ,UAAM,IAAI,MAAM,uDAAuD;AAAA,EACzE;AACA,SAAO;AACT;","names":[]}
1
+ {"version":3,"sources":["../../src/context/field.tsx"],"sourcesContent":["'use client'\n\nimport {\n createContext,\n useContext,\n useMemo,\n type PropsWithChildren,\n} from 'react'\n\nexport interface FieldContextValue {\n disabled?: boolean\n readOnly?: boolean\n required?: boolean\n invalid?: boolean\n}\n\nconst FieldContext = createContext<FieldContextValue | null>(null)\n\nexport function Field(\n props: PropsWithChildren<FieldContextValue>,\n): JSX.Element {\n const value = useMemo(\n () => ({\n disabled: props.disabled,\n readOnly: props.readOnly,\n required: props.required,\n invalid: props.invalid,\n }),\n [props.disabled, props.readOnly, props.required, props.invalid],\n )\n\n return (\n <FieldContext.Provider value={value}>\n {props.children}\n </FieldContext.Provider>\n )\n}\n\nexport function useFieldContext(): FieldContextValue {\n const context = useContext(FieldContext)\n if (!context) {\n throw new Error('useFieldContext must be used within a Field Provider.')\n }\n return context\n}\n"],"mappings":";AAEA;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,OAEK;AAyBH;AAhBJ,IAAM,eAAe,cAAwC,IAAI;AAE1D,SAAS,MACd,OACa;AACb,QAAM,QAAQ;AAAA,IACZ,OAAO;AAAA,MACL,UAAU,MAAM;AAAA,MAChB,UAAU,MAAM;AAAA,MAChB,UAAU,MAAM;AAAA,MAChB,SAAS,MAAM;AAAA,IACjB;AAAA,IACA,CAAC,MAAM,UAAU,MAAM,UAAU,MAAM,UAAU,MAAM,OAAO;AAAA,EAChE;AAEA,SACE,oBAAC,aAAa,UAAb,EAAsB,OACpB,gBAAM,UACT;AAEJ;AAEO,SAAS,kBAAqC;AACnD,QAAM,UAAU,WAAW,YAAY;AACvC,MAAI,CAAC,SAAS;AACZ,UAAM,IAAI,MAAM,uDAAuD;AAAA,EACzE;AACA,SAAO;AACT;","names":[]}
@@ -1,8 +1,8 @@
1
1
  "use client";
2
2
  import {
3
3
  FieldMessage
4
- } from "../chunk-6VY34K3P.js";
5
- import "../chunk-KETL4ZJK.js";
4
+ } from "../chunk-YVUZSAJG.js";
5
+ import "../chunk-ZAU4JVLL.js";
6
6
  export {
7
7
  FieldMessage
8
8
  };
@@ -0,0 +1,2 @@
1
+ export { Input_alias_1 as Input } from '../_tsup-dts-rollup';
2
+ export { InputProps_alias_1 as InputProps } from '../_tsup-dts-rollup';
@@ -0,0 +1,10 @@
1
+ "use client";
2
+ import {
3
+ Input
4
+ } from "../chunk-LD5ZV46F.js";
5
+ import "../chunk-R4H3352X.js";
6
+ import "../chunk-ZAU4JVLL.js";
7
+ export {
8
+ Input
9
+ };
10
+ //# sourceMappingURL=Input.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-EYZ3S36P.js";
4
+ } from "../chunk-OXVNTE4A.js";
5
5
  import "../chunk-R4H3352X.js";
6
- import "../chunk-KETL4ZJK.js";
6
+ import "../chunk-ZAU4JVLL.js";
7
7
  export {
8
8
  Label
9
9
  };
@@ -2,7 +2,7 @@
2
2
  import {
3
3
  Field,
4
4
  useFieldContext
5
- } from "../chunk-KETL4ZJK.js";
5
+ } from "../chunk-ZAU4JVLL.js";
6
6
  export {
7
7
  Field,
8
8
  useFieldContext
@@ -5,6 +5,8 @@ export { FieldMessageProps } from './_tsup-dts-rollup';
5
5
  export { IconButton } from './_tsup-dts-rollup';
6
6
  export { IconButtonUsage } from './_tsup-dts-rollup';
7
7
  export { IconButtonProps } from './_tsup-dts-rollup';
8
+ export { Input } from './_tsup-dts-rollup';
9
+ export { InputProps } from './_tsup-dts-rollup';
8
10
  export { Label } from './_tsup-dts-rollup';
9
11
  export { LabelProps } from './_tsup-dts-rollup';
10
12
  export { NavMenuTrigger } from './_tsup-dts-rollup';
@@ -1,3 +1,6 @@
1
+ import {
2
+ Label
3
+ } from "./chunk-OXVNTE4A.js";
1
4
  import {
2
5
  NavMenuLink
3
6
  } from "./chunk-JA4IX7GN.js";
@@ -28,25 +31,26 @@ import {
28
31
  } from "./chunk-XFWARXLU.js";
29
32
  import {
30
33
  FieldMessage
31
- } from "./chunk-6VY34K3P.js";
34
+ } from "./chunk-YVUZSAJG.js";
32
35
  import {
33
36
  IconButton
34
37
  } from "./chunk-BPIYUAYS.js";
35
38
  import {
36
- Label
37
- } from "./chunk-EYZ3S36P.js";
39
+ Input
40
+ } from "./chunk-LD5ZV46F.js";
38
41
  import {
39
42
  Show
40
43
  } from "./chunk-R4H3352X.js";
41
44
  import {
42
45
  Field,
43
46
  useFieldContext
44
- } from "./chunk-KETL4ZJK.js";
47
+ } from "./chunk-ZAU4JVLL.js";
45
48
  export {
46
49
  Button,
47
50
  Field,
48
51
  FieldMessage,
49
52
  IconButton,
53
+ Input,
50
54
  Label,
51
55
  MODE_KEY,
52
56
  NavMenu,
@@ -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 type { InputHTMLAttributes } from 'react';
5
6
  import { JSX as JSX_2 } from 'react/jsx-runtime';
6
7
  import { PropsWithChildren } from 'react';
7
8
  import { ReactNode } from 'react';
@@ -49,7 +50,7 @@ export { Field as Field_alias_1 }
49
50
 
50
51
  declare interface FieldContextValue {
51
52
  disabled?: boolean;
52
- readonly?: boolean;
53
+ readOnly?: boolean;
53
54
  required?: boolean;
54
55
  invalid?: boolean;
55
56
  }
@@ -120,6 +121,18 @@ declare type IconButtonUsage = Exclude<ButtonProps['usage'], 'outline'>;
120
121
  export { IconButtonUsage }
121
122
  export { IconButtonUsage as IconButtonUsage_alias_1 }
122
123
 
124
+ declare function Input(props: InputProps): JSX_2.Element;
125
+ export { Input }
126
+ export { Input as Input_alias_1 }
127
+
128
+ declare interface InputProps extends Omit<InputHTMLAttributes<HTMLInputElement>, 'id' | 'size'> {
129
+ describedBy?: string;
130
+ id: string;
131
+ size?: 'sm' | 'md' | 'lg';
132
+ }
133
+ export { InputProps }
134
+ export { InputProps as InputProps_alias_1 }
135
+
123
136
  /**
124
137
  * A screen ready friendly label component.
125
138
  * @definition [ARIA Forms](https://www.a11yproject.com/checklist/#forms)
@@ -0,0 +1,35 @@
1
+ import {
2
+ Show
3
+ } from "./chunk-R4H3352X.js";
4
+ import {
5
+ useFieldContext
6
+ } from "./chunk-ZAU4JVLL.js";
7
+
8
+ // src/components/Input.tsx
9
+ import { WarningFilled } from "@cerberus/icons";
10
+ import { input } from "@cerberus/styled-system/recipes";
11
+ import { cx } from "@cerberus/styled-system/css";
12
+ import { jsx, jsxs } from "react/jsx-runtime";
13
+ function Input(props) {
14
+ const { describedBy, size, ...nativeProps } = props;
15
+ const inputStyles = input({ size });
16
+ const { invalid, ...fieldStates } = useFieldContext();
17
+ return /* @__PURE__ */ jsxs("div", { className: inputStyles.root, children: [
18
+ /* @__PURE__ */ jsx(
19
+ "input",
20
+ {
21
+ ...nativeProps,
22
+ ...fieldStates,
23
+ ...describedBy && { "aria-describedby": describedBy },
24
+ ...invalid && { "aria-invalid": true },
25
+ className: cx("peer", nativeProps.className, inputStyles.input)
26
+ }
27
+ ),
28
+ /* @__PURE__ */ jsx(Show, { when: invalid, children: /* @__PURE__ */ jsx(WarningFilled, { className: inputStyles.icon }) })
29
+ ] });
30
+ }
31
+
32
+ export {
33
+ Input
34
+ };
35
+ //# sourceMappingURL=chunk-LD5ZV46F.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/components/Input.tsx"],"sourcesContent":["'use client'\n\nimport type { InputHTMLAttributes } from 'react'\nimport { WarningFilled } from '@cerberus/icons'\nimport { input } from '@cerberus/styled-system/recipes'\nimport { cx } from '@cerberus/styled-system/css'\nimport { useFieldContext } from '../context/field'\nimport { Show } from './Show'\n\nexport interface InputProps\n extends Omit<InputHTMLAttributes<HTMLInputElement>, 'id' | 'size'> {\n describedBy?: string\n id: string\n size?: 'sm' | 'md' | 'lg'\n}\n\nexport function Input(props: InputProps) {\n const { describedBy, size, ...nativeProps } = props\n const inputStyles = input({ size })\n const { invalid, ...fieldStates } = useFieldContext()\n\n return (\n <div className={inputStyles.root}>\n <input\n {...nativeProps}\n {...fieldStates}\n {...(describedBy && { 'aria-describedby': describedBy })}\n {...(invalid && { 'aria-invalid': true })}\n className={cx('peer', nativeProps.className, inputStyles.input)}\n />\n <Show when={invalid}>\n <WarningFilled className={inputStyles.icon} />\n </Show>\n </div>\n )\n}\n"],"mappings":";;;;;;;;AAGA,SAAS,qBAAqB;AAC9B,SAAS,aAAa;AACtB,SAAS,UAAU;AAiBf,SACE,KADF;AANG,SAAS,MAAM,OAAmB;AACvC,QAAM,EAAE,aAAa,MAAM,GAAG,YAAY,IAAI;AAC9C,QAAM,cAAc,MAAM,EAAE,KAAK,CAAC;AAClC,QAAM,EAAE,SAAS,GAAG,YAAY,IAAI,gBAAgB;AAEpD,SACE,qBAAC,SAAI,WAAW,YAAY,MAC1B;AAAA;AAAA,MAAC;AAAA;AAAA,QACE,GAAG;AAAA,QACH,GAAG;AAAA,QACH,GAAI,eAAe,EAAE,oBAAoB,YAAY;AAAA,QACrD,GAAI,WAAW,EAAE,gBAAgB,KAAK;AAAA,QACvC,WAAW,GAAG,QAAQ,YAAY,WAAW,YAAY,KAAK;AAAA;AAAA,IAChE;AAAA,IACA,oBAAC,QAAK,MAAM,SACV,8BAAC,iBAAc,WAAW,YAAY,MAAM,GAC9C;AAAA,KACF;AAEJ;","names":[]}
@@ -3,7 +3,7 @@ import {
3
3
  } from "./chunk-R4H3352X.js";
4
4
  import {
5
5
  useFieldContext
6
- } from "./chunk-KETL4ZJK.js";
6
+ } from "./chunk-ZAU4JVLL.js";
7
7
 
8
8
  // src/components/Label.tsx
9
9
  import { label } from "@cerberus/styled-system/recipes";
@@ -45,4 +45,4 @@ function Label(props) {
45
45
  export {
46
46
  Label
47
47
  };
48
- //# sourceMappingURL=chunk-EYZ3S36P.js.map
48
+ //# sourceMappingURL=chunk-OXVNTE4A.js.map
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  useFieldContext
3
- } from "./chunk-KETL4ZJK.js";
3
+ } from "./chunk-ZAU4JVLL.js";
4
4
 
5
5
  // src/components/FieldMessage.tsx
6
6
  import { cx } from "@cerberus/styled-system/css";
@@ -21,4 +21,4 @@ function FieldMessage(props) {
21
21
  export {
22
22
  FieldMessage
23
23
  };
24
- //# sourceMappingURL=chunk-6VY34K3P.js.map
24
+ //# sourceMappingURL=chunk-YVUZSAJG.js.map
@@ -10,11 +10,11 @@ function Field(props) {
10
10
  const value = useMemo(
11
11
  () => ({
12
12
  disabled: props.disabled,
13
- readonly: props.readonly,
13
+ readOnly: props.readOnly,
14
14
  required: props.required,
15
15
  invalid: props.invalid
16
16
  }),
17
- [props.disabled, props.readonly, props.required, props.invalid]
17
+ [props.disabled, props.readOnly, props.required, props.invalid]
18
18
  );
19
19
  return /* @__PURE__ */ jsx(FieldContext.Provider, { value, children: props.children });
20
20
  }
@@ -30,4 +30,4 @@ export {
30
30
  Field,
31
31
  useFieldContext
32
32
  };
33
- //# sourceMappingURL=chunk-KETL4ZJK.js.map
33
+ //# sourceMappingURL=chunk-ZAU4JVLL.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/context/field.tsx"],"sourcesContent":["'use client'\n\nimport {\n createContext,\n useContext,\n useMemo,\n type PropsWithChildren,\n} from 'react'\n\nexport interface FieldContextValue {\n disabled?: boolean\n readonly?: boolean\n required?: boolean\n invalid?: boolean\n}\n\nconst FieldContext = createContext<FieldContextValue | null>(null)\n\nexport function Field(\n props: PropsWithChildren<FieldContextValue>,\n): JSX.Element {\n const value = useMemo(\n () => ({\n disabled: props.disabled,\n readonly: props.readonly,\n required: props.required,\n invalid: props.invalid,\n }),\n [props.disabled, props.readonly, props.required, props.invalid],\n )\n\n return (\n <FieldContext.Provider value={value}>\n {props.children}\n </FieldContext.Provider>\n )\n}\n\nexport function useFieldContext(): FieldContextValue {\n const context = useContext(FieldContext)\n if (!context) {\n throw new Error('useFieldContext must be used within a Field Provider.')\n }\n return context\n}\n"],"mappings":";AAEA;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,OAEK;AAyBH;AAhBJ,IAAM,eAAe,cAAwC,IAAI;AAE1D,SAAS,MACd,OACa;AACb,QAAM,QAAQ;AAAA,IACZ,OAAO;AAAA,MACL,UAAU,MAAM;AAAA,MAChB,UAAU,MAAM;AAAA,MAChB,UAAU,MAAM;AAAA,MAChB,SAAS,MAAM;AAAA,IACjB;AAAA,IACA,CAAC,MAAM,UAAU,MAAM,UAAU,MAAM,UAAU,MAAM,OAAO;AAAA,EAChE;AAEA,SACE,oBAAC,aAAa,UAAb,EAAsB,OACpB,gBAAM,UACT;AAEJ;AAEO,SAAS,kBAAqC;AACnD,QAAM,UAAU,WAAW,YAAY;AACvC,MAAI,CAAC,SAAS;AACZ,UAAM,IAAI,MAAM,uDAAuD;AAAA,EACzE;AACA,SAAO;AACT;","names":[]}
1
+ {"version":3,"sources":["../../src/context/field.tsx"],"sourcesContent":["'use client'\n\nimport {\n createContext,\n useContext,\n useMemo,\n type PropsWithChildren,\n} from 'react'\n\nexport interface FieldContextValue {\n disabled?: boolean\n readOnly?: boolean\n required?: boolean\n invalid?: boolean\n}\n\nconst FieldContext = createContext<FieldContextValue | null>(null)\n\nexport function Field(\n props: PropsWithChildren<FieldContextValue>,\n): JSX.Element {\n const value = useMemo(\n () => ({\n disabled: props.disabled,\n readOnly: props.readOnly,\n required: props.required,\n invalid: props.invalid,\n }),\n [props.disabled, props.readOnly, props.required, props.invalid],\n )\n\n return (\n <FieldContext.Provider value={value}>\n {props.children}\n </FieldContext.Provider>\n )\n}\n\nexport function useFieldContext(): FieldContextValue {\n const context = useContext(FieldContext)\n if (!context) {\n throw new Error('useFieldContext must be used within a Field Provider.')\n }\n return context\n}\n"],"mappings":";AAEA;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,OAEK;AAyBH;AAhBJ,IAAM,eAAe,cAAwC,IAAI;AAE1D,SAAS,MACd,OACa;AACb,QAAM,QAAQ;AAAA,IACZ,OAAO;AAAA,MACL,UAAU,MAAM;AAAA,MAChB,UAAU,MAAM;AAAA,MAChB,UAAU,MAAM;AAAA,MAChB,SAAS,MAAM;AAAA,IACjB;AAAA,IACA,CAAC,MAAM,UAAU,MAAM,UAAU,MAAM,UAAU,MAAM,OAAO;AAAA,EAChE;AAEA,SACE,oBAAC,aAAa,UAAb,EAAsB,OACpB,gBAAM,UACT;AAEJ;AAEO,SAAS,kBAAqC;AACnD,QAAM,UAAU,WAAW,YAAY;AACvC,MAAI,CAAC,SAAS;AACZ,UAAM,IAAI,MAAM,uDAAuD;AAAA,EACzE;AACA,SAAO;AACT;","names":[]}
@@ -1,8 +1,8 @@
1
1
  "use client";
2
2
  import {
3
3
  FieldMessage
4
- } from "../chunk-6VY34K3P.js";
5
- import "../chunk-KETL4ZJK.js";
4
+ } from "../chunk-YVUZSAJG.js";
5
+ import "../chunk-ZAU4JVLL.js";
6
6
  export {
7
7
  FieldMessage
8
8
  };
@@ -0,0 +1,2 @@
1
+ export { Input_alias_1 as Input } from '../_tsup-dts-rollup';
2
+ export { InputProps_alias_1 as InputProps } from '../_tsup-dts-rollup';
@@ -0,0 +1,10 @@
1
+ "use client";
2
+ import {
3
+ Input
4
+ } from "../chunk-LD5ZV46F.js";
5
+ import "../chunk-R4H3352X.js";
6
+ import "../chunk-ZAU4JVLL.js";
7
+ export {
8
+ Input
9
+ };
10
+ //# sourceMappingURL=Input.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-EYZ3S36P.js";
4
+ } from "../chunk-OXVNTE4A.js";
5
5
  import "../chunk-R4H3352X.js";
6
- import "../chunk-KETL4ZJK.js";
6
+ import "../chunk-ZAU4JVLL.js";
7
7
  export {
8
8
  Label
9
9
  };
@@ -2,7 +2,7 @@
2
2
  import {
3
3
  Field,
4
4
  useFieldContext
5
- } from "../chunk-KETL4ZJK.js";
5
+ } from "../chunk-ZAU4JVLL.js";
6
6
  export {
7
7
  Field,
8
8
  useFieldContext
@@ -5,6 +5,8 @@ export { FieldMessageProps } from './_tsup-dts-rollup';
5
5
  export { IconButton } from './_tsup-dts-rollup';
6
6
  export { IconButtonUsage } from './_tsup-dts-rollup';
7
7
  export { IconButtonProps } from './_tsup-dts-rollup';
8
+ export { Input } from './_tsup-dts-rollup';
9
+ export { InputProps } from './_tsup-dts-rollup';
8
10
  export { Label } from './_tsup-dts-rollup';
9
11
  export { LabelProps } from './_tsup-dts-rollup';
10
12
  export { NavMenuTrigger } from './_tsup-dts-rollup';
@@ -1,3 +1,6 @@
1
+ import {
2
+ Label
3
+ } from "./chunk-OXVNTE4A.js";
1
4
  import {
2
5
  NavMenuLink
3
6
  } from "./chunk-JA4IX7GN.js";
@@ -28,25 +31,26 @@ import {
28
31
  } from "./chunk-XFWARXLU.js";
29
32
  import {
30
33
  FieldMessage
31
- } from "./chunk-6VY34K3P.js";
34
+ } from "./chunk-YVUZSAJG.js";
32
35
  import {
33
36
  IconButton
34
37
  } from "./chunk-BPIYUAYS.js";
35
38
  import {
36
- Label
37
- } from "./chunk-EYZ3S36P.js";
39
+ Input
40
+ } from "./chunk-LD5ZV46F.js";
38
41
  import {
39
42
  Show
40
43
  } from "./chunk-R4H3352X.js";
41
44
  import {
42
45
  Field,
43
46
  useFieldContext
44
- } from "./chunk-KETL4ZJK.js";
47
+ } from "./chunk-ZAU4JVLL.js";
45
48
  export {
46
49
  Button,
47
50
  Field,
48
51
  FieldMessage,
49
52
  IconButton,
53
+ Input,
50
54
  Label,
51
55
  MODE_KEY,
52
56
  NavMenu,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cerberus-design/react",
3
- "version": "0.1.3-next-cb1c11b",
3
+ "version": "0.1.3-next-59f45d9",
4
4
  "description": "The Cerberus Design React component library.",
5
5
  "browserslist": "> 0.25%, not dead",
6
6
  "sideEffects": false,
@@ -10,6 +10,7 @@
10
10
  "peerDependencies": {
11
11
  "@cerberus/panda-preset": "npm:@jsr/cerberus__panda-preset",
12
12
  "@cerberus/styled-system": "npm:@cerberus-design/styled-system@next",
13
+ "@cerberus/icons": "npm:@jsr/cerberus__icons",
13
14
  "@pandacss/dev": "*",
14
15
  "react": "*",
15
16
  "react-dom": "*"
@@ -0,0 +1,36 @@
1
+ 'use client'
2
+
3
+ import type { InputHTMLAttributes } from 'react'
4
+ import { WarningFilled } from '@cerberus/icons'
5
+ import { input } from '@cerberus/styled-system/recipes'
6
+ import { cx } from '@cerberus/styled-system/css'
7
+ import { useFieldContext } from '../context/field'
8
+ import { Show } from './Show'
9
+
10
+ export interface InputProps
11
+ extends Omit<InputHTMLAttributes<HTMLInputElement>, 'id' | 'size'> {
12
+ describedBy?: string
13
+ id: string
14
+ size?: 'sm' | 'md' | 'lg'
15
+ }
16
+
17
+ export function Input(props: InputProps) {
18
+ const { describedBy, size, ...nativeProps } = props
19
+ const inputStyles = input({ size })
20
+ const { invalid, ...fieldStates } = useFieldContext()
21
+
22
+ return (
23
+ <div className={inputStyles.root}>
24
+ <input
25
+ {...nativeProps}
26
+ {...fieldStates}
27
+ {...(describedBy && { 'aria-describedby': describedBy })}
28
+ {...(invalid && { 'aria-invalid': true })}
29
+ className={cx('peer', nativeProps.className, inputStyles.input)}
30
+ />
31
+ <Show when={invalid}>
32
+ <WarningFilled className={inputStyles.icon} />
33
+ </Show>
34
+ </div>
35
+ )
36
+ }
@@ -9,7 +9,7 @@ import {
9
9
 
10
10
  export interface FieldContextValue {
11
11
  disabled?: boolean
12
- readonly?: boolean
12
+ readOnly?: boolean
13
13
  required?: boolean
14
14
  invalid?: boolean
15
15
  }
@@ -22,11 +22,11 @@ export function Field(
22
22
  const value = useMemo(
23
23
  () => ({
24
24
  disabled: props.disabled,
25
- readonly: props.readonly,
25
+ readOnly: props.readOnly,
26
26
  required: props.required,
27
27
  invalid: props.invalid,
28
28
  }),
29
- [props.disabled, props.readonly, props.required, props.invalid],
29
+ [props.disabled, props.readOnly, props.required, props.invalid],
30
30
  )
31
31
 
32
32
  return (
package/src/index.ts CHANGED
@@ -8,6 +8,7 @@
8
8
  export * from './components/Button'
9
9
  export * from './components/FieldMessage'
10
10
  export * from './components/IconButton'
11
+ export * from './components/Input'
11
12
  export * from './components/Label'
12
13
  export * from './components/NavMenuTrigger'
13
14
  export * from './components/NavMenuList'