@cerberus-design/react 0.5.2-next-782341c → 0.5.2-next-41ff124
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 +44 -14
- package/build/{modern/chunk-KO7LBJGB.js → legacy/chunk-6SAA3NUE.js} +1 -1
- package/build/legacy/chunk-6SAA3NUE.js.map +1 -0
- package/build/{modern/chunk-PFY74S3Z.js → legacy/chunk-CINUA3C7.js} +1 -1
- package/build/legacy/chunk-CINUA3C7.js.map +1 -0
- package/build/{modern/chunk-MFKR532P.js → legacy/chunk-SLHX5K6I.js} +1 -1
- package/build/legacy/chunk-SLHX5K6I.js.map +1 -0
- package/build/legacy/{chunk-5TBINKAO.js → chunk-TCO46FK7.js} +1 -1
- package/build/legacy/chunk-TCO46FK7.js.map +1 -0
- package/build/{modern/chunk-YVUZSAJG.js → legacy/chunk-VGHVH2T3.js} +1 -1
- package/build/legacy/chunk-VGHVH2T3.js.map +1 -0
- package/build/legacy/components/FieldMessage.js +1 -1
- package/build/legacy/components/IconButton.js +1 -1
- package/build/legacy/components/Input.js +1 -1
- package/build/legacy/components/Label.js +1 -1
- package/build/legacy/components/Textarea.js +1 -1
- package/build/legacy/index.js +5 -5
- package/build/modern/_tsup-dts-rollup.d.ts +44 -14
- package/build/{legacy/chunk-KO7LBJGB.js → modern/chunk-6SAA3NUE.js} +1 -1
- package/build/modern/chunk-6SAA3NUE.js.map +1 -0
- package/build/{legacy/chunk-PFY74S3Z.js → modern/chunk-CINUA3C7.js} +1 -1
- package/build/modern/chunk-CINUA3C7.js.map +1 -0
- package/build/{legacy/chunk-MFKR532P.js → modern/chunk-SLHX5K6I.js} +1 -1
- package/build/modern/chunk-SLHX5K6I.js.map +1 -0
- package/build/modern/{chunk-5TBINKAO.js → chunk-TCO46FK7.js} +1 -1
- package/build/modern/chunk-TCO46FK7.js.map +1 -0
- package/build/{legacy/chunk-YVUZSAJG.js → modern/chunk-VGHVH2T3.js} +1 -1
- package/build/modern/chunk-VGHVH2T3.js.map +1 -0
- package/build/modern/components/FieldMessage.js +1 -1
- package/build/modern/components/IconButton.js +1 -1
- package/build/modern/components/Input.js +1 -1
- package/build/modern/components/Label.js +1 -1
- package/build/modern/components/Textarea.js +1 -1
- package/build/modern/index.js +5 -5
- package/package.json +3 -3
- package/src/components/FieldMessage.tsx +4 -2
- package/src/components/IconButton.tsx +2 -1
- package/src/components/Input.tsx +5 -3
- package/src/components/Label.tsx +4 -2
- package/src/components/Textarea.tsx +3 -1
- package/build/legacy/chunk-5TBINKAO.js.map +0 -1
- package/build/legacy/chunk-KO7LBJGB.js.map +0 -1
- package/build/legacy/chunk-MFKR532P.js.map +0 -1
- package/build/legacy/chunk-PFY74S3Z.js.map +0 -1
- package/build/legacy/chunk-YVUZSAJG.js.map +0 -1
- package/build/modern/chunk-5TBINKAO.js.map +0 -1
- package/build/modern/chunk-KO7LBJGB.js.map +0 -1
- package/build/modern/chunk-MFKR532P.js.map +0 -1
- package/build/modern/chunk-PFY74S3Z.js.map +0 -1
- package/build/modern/chunk-YVUZSAJG.js.map +0 -1
|
@@ -4,10 +4,13 @@ import { ButtonHTMLAttributes } from 'react';
|
|
|
4
4
|
import type { ConditionalValue } from '@cerberus/styled-system/types';
|
|
5
5
|
import { Context } from 'react';
|
|
6
6
|
import { ElementType } from 'react';
|
|
7
|
+
import { fieldMessage } from '@cerberus/styled-system/recipes';
|
|
7
8
|
import { HTMLAttributes } from 'react';
|
|
8
9
|
import { iconButton } from '@cerberus/styled-system/recipes';
|
|
10
|
+
import { input } from '@cerberus/styled-system/recipes';
|
|
9
11
|
import type { InputHTMLAttributes } from 'react';
|
|
10
12
|
import { JSX as JSX_2 } from 'react/jsx-runtime';
|
|
13
|
+
import { label } from '@cerberus/styled-system/recipes';
|
|
11
14
|
import { MutableRefObject } from 'react';
|
|
12
15
|
import { PropsWithChildren } from 'react';
|
|
13
16
|
import { ReactNode } from 'react';
|
|
@@ -89,16 +92,24 @@ declare function FieldMessage(props: FieldMessageProps): JSX_2.Element;
|
|
|
89
92
|
export { FieldMessage }
|
|
90
93
|
export { FieldMessage as FieldMessage_alias_1 }
|
|
91
94
|
|
|
92
|
-
|
|
93
|
-
* This module contains the FieldMessage component.
|
|
94
|
-
* @module
|
|
95
|
-
*/
|
|
96
|
-
declare interface FieldMessageProps extends HTMLAttributes<HTMLParagraphElement> {
|
|
95
|
+
declare interface FieldMessageBaseProps extends HTMLAttributes<HTMLParagraphElement> {
|
|
97
96
|
id: string;
|
|
98
97
|
}
|
|
98
|
+
export { FieldMessageBaseProps }
|
|
99
|
+
export { FieldMessageBaseProps as FieldMessageBaseProps_alias_1 }
|
|
100
|
+
|
|
101
|
+
declare type FieldMessageProps = FieldMessageBaseProps & FieldMessageRecipe;
|
|
99
102
|
export { FieldMessageProps }
|
|
100
103
|
export { FieldMessageProps as FieldMessageProps_alias_1 }
|
|
101
104
|
|
|
105
|
+
/**
|
|
106
|
+
* This module contains the FieldMessage component.
|
|
107
|
+
* @module
|
|
108
|
+
*/
|
|
109
|
+
declare type FieldMessageRecipe = RecipeVariantProps<typeof fieldMessage>;
|
|
110
|
+
export { FieldMessageRecipe }
|
|
111
|
+
export { FieldMessageRecipe as FieldMessageRecipe_alias_1 }
|
|
112
|
+
|
|
102
113
|
declare function getPosition(position: Positions): GetPositionResult;
|
|
103
114
|
export { getPosition }
|
|
104
115
|
export { getPosition as getPosition_alias_1 }
|
|
@@ -128,7 +139,7 @@ export { IconButtonProps as IconButtonProps_alias_1 }
|
|
|
128
139
|
*/
|
|
129
140
|
declare interface IconButtonRawProps extends ButtonHTMLAttributes<HTMLButtonElement> {
|
|
130
141
|
ariaLabel: string;
|
|
131
|
-
tooltipPosition?:
|
|
142
|
+
tooltipPosition?: Positions;
|
|
132
143
|
}
|
|
133
144
|
export { IconButtonRawProps }
|
|
134
145
|
export { IconButtonRawProps as IconButtonRawProps_alias_1 }
|
|
@@ -141,14 +152,21 @@ declare function Input(props: InputProps): JSX_2.Element;
|
|
|
141
152
|
export { Input }
|
|
142
153
|
export { Input as Input_alias_1 }
|
|
143
154
|
|
|
144
|
-
declare interface
|
|
155
|
+
declare interface InputBaseProps extends Omit<InputHTMLAttributes<HTMLInputElement>, 'id' | 'size'> {
|
|
145
156
|
describedBy?: string;
|
|
146
157
|
id: string;
|
|
147
|
-
size?: 'sm' | 'md' | 'lg';
|
|
148
158
|
}
|
|
159
|
+
export { InputBaseProps }
|
|
160
|
+
export { InputBaseProps as InputBaseProps_alias_1 }
|
|
161
|
+
|
|
162
|
+
declare type InputProps = InputBaseProps & InputRecipeProps;
|
|
149
163
|
export { InputProps }
|
|
150
164
|
export { InputProps as InputProps_alias_1 }
|
|
151
165
|
|
|
166
|
+
declare type InputRecipeProps = RecipeVariantProps<typeof input>;
|
|
167
|
+
export { InputRecipeProps }
|
|
168
|
+
export { InputRecipeProps as InputRecipeProps_alias_1 }
|
|
169
|
+
|
|
152
170
|
/**
|
|
153
171
|
* A screen ready friendly label component.
|
|
154
172
|
* @definition [ARIA Forms](https://www.a11yproject.com/checklist/#forms)
|
|
@@ -164,17 +182,25 @@ declare function Label(props: PropsWithChildren<LabelProps>): JSX_2.Element;
|
|
|
164
182
|
export { Label }
|
|
165
183
|
export { Label as Label_alias_1 }
|
|
166
184
|
|
|
167
|
-
|
|
168
|
-
* This module contains the Label component.
|
|
169
|
-
* @module
|
|
170
|
-
*/
|
|
171
|
-
declare interface LabelProps extends HTMLAttributes<HTMLLabelElement> {
|
|
185
|
+
declare interface LabelBaseProps extends HTMLAttributes<HTMLLabelElement> {
|
|
172
186
|
htmlFor: string;
|
|
173
187
|
hidden?: boolean;
|
|
174
188
|
}
|
|
189
|
+
export { LabelBaseProps }
|
|
190
|
+
export { LabelBaseProps as LabelBaseProps_alias_1 }
|
|
191
|
+
|
|
192
|
+
declare type LabelProps = LabelBaseProps & LabelRecipeProps;
|
|
175
193
|
export { LabelProps }
|
|
176
194
|
export { LabelProps as LabelProps_alias_1 }
|
|
177
195
|
|
|
196
|
+
/**
|
|
197
|
+
* This module contains the Label component.
|
|
198
|
+
* @module
|
|
199
|
+
*/
|
|
200
|
+
declare type LabelRecipeProps = RecipeVariantProps<typeof label>;
|
|
201
|
+
export { LabelRecipeProps }
|
|
202
|
+
export { LabelRecipeProps as LabelRecipeProps_alias_1 }
|
|
203
|
+
|
|
178
204
|
declare const MODE_KEY = "cerberus-mode";
|
|
179
205
|
export { MODE_KEY }
|
|
180
206
|
export { MODE_KEY as MODE_KEY_alias_1 }
|
|
@@ -457,10 +483,14 @@ export { Textarea as Textarea_alias_1 }
|
|
|
457
483
|
* This module contains the Textarea component.
|
|
458
484
|
* @module
|
|
459
485
|
*/
|
|
460
|
-
declare interface
|
|
486
|
+
declare interface TextareaBaseProps extends Omit<TextareaHTMLAttributes<HTMLTextAreaElement>, 'id'> {
|
|
461
487
|
describedBy?: string;
|
|
462
488
|
id: string;
|
|
463
489
|
}
|
|
490
|
+
export { TextareaBaseProps }
|
|
491
|
+
export { TextareaBaseProps as TextareaBaseProps_alias_1 }
|
|
492
|
+
|
|
493
|
+
declare type TextareaProps = InputRecipeProps & TextareaBaseProps;
|
|
464
494
|
export { TextareaProps }
|
|
465
495
|
export { TextareaProps as TextareaProps_alias_1 }
|
|
466
496
|
|
|
@@ -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, type RecipeVariantProps } from '@cerberus/styled-system/css'\nimport { useFieldContext } from '../context/field'\nimport { Show } from './Show'\n\nexport type InputRecipeProps = RecipeVariantProps<typeof input>\n\nexport interface InputBaseProps\n extends Omit<InputHTMLAttributes<HTMLInputElement>, 'id' | 'size'> {\n describedBy?: string\n id: string\n}\nexport type InputProps = InputBaseProps & InputRecipeProps\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,UAAmC;AAmBxC,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":[]}
|
|
@@ -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 { 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":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/components/IconButton.tsx"],"sourcesContent":["import type { ButtonHTMLAttributes } from 'react'\nimport { cx, type RecipeVariantProps } from '@cerberus/styled-system/css'\nimport { iconButton } from '@cerberus/styled-system/recipes'\nimport type { Positions } from '../types'\n\n/**\n * This module contains the Icon Button component.\n * @module\n */\n\nexport interface IconButtonRawProps\n extends ButtonHTMLAttributes<HTMLButtonElement> {\n ariaLabel: string\n tooltipPosition?: Positions\n}\nexport type IconButtonRecipeProps = RecipeVariantProps<typeof iconButton>\nexport type IconButtonProps = IconButtonRawProps & IconButtonRecipeProps\n\n/**\n * A component that allows the user to perform actions using an icon\n * @description https://github.com/omnifed/cerberus/blob/main/packages/react/src/components/IconButton.tsx\n */\nexport function IconButton(props: IconButtonProps): JSX.Element {\n const { ariaLabel, palette, usage, size, ...nativeProps } = props\n return (\n <button\n {...nativeProps}\n data-tooltip\n data-position={props.tooltipPosition ?? 'top'}\n aria-label={ariaLabel ?? 'Icon Button'}\n className={cx(\n nativeProps.className,\n iconButton({\n palette,\n usage,\n size,\n }),\n )}\n />\n )\n}\n"],"mappings":";AACA,SAAS,UAAmC;AAC5C,SAAS,kBAAkB;AAuBvB;AAHG,SAAS,WAAW,OAAqC;AAC9D,QAAM,EAAE,WAAW,SAAS,OAAO,MAAM,GAAG,YAAY,IAAI;AAC5D,SACE;AAAA,IAAC;AAAA;AAAA,MACE,GAAG;AAAA,MACJ,gBAAY;AAAA,MACZ,iBAAe,MAAM,mBAAmB;AAAA,MACxC,cAAY,aAAa;AAAA,MACzB,WAAW;AAAA,QACT,YAAY;AAAA,QACZ,WAAW;AAAA,UACT;AAAA,UACA;AAAA,UACA;AAAA,QACF,CAAC;AAAA,MACH;AAAA;AAAA,EACF;AAEJ;","names":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/components/Textarea.tsx"],"sourcesContent":["'use client'\n\nimport type { TextareaHTMLAttributes } from 'react'\nimport { css, cx } from '@cerberus/styled-system/css'\nimport { input } from '@cerberus/styled-system/recipes'\nimport { useFieldContext } from '../context/field'\nimport type { InputRecipeProps } from './Input'\n\n/**\n * This module contains the Textarea component.\n * @module\n */\n\nexport interface TextareaBaseProps\n extends Omit<TextareaHTMLAttributes<HTMLTextAreaElement>, 'id'> {\n describedBy?: string\n id: string\n}\nexport type TextareaProps = InputRecipeProps & TextareaBaseProps\n\n/**\n * A component that allows the user to input large blocks of text.\n * @description https://github.com/omnifed/cerberus/blob/main/packages/react/src/components/Textarea.tsx\n */\nexport function Textarea(props: TextareaProps): JSX.Element {\n const { describedBy, ...nativeProps } = props\n const { invalid, ...fieldState } = useFieldContext()\n\n return (\n <textarea\n {...nativeProps}\n {...fieldState}\n {...(describedBy && { 'aria-describedby': describedBy })}\n {...(invalid && { 'aria-invalid': true })}\n className={cx(\n props.className,\n input().input,\n css({\n pxi: '2',\n py: '2',\n resize: 'vertical',\n }),\n )}\n rows={4}\n />\n )\n}\n"],"mappings":";;;;;AAGA,SAAS,KAAK,UAAU;AACxB,SAAS,aAAa;AAyBlB;AALG,SAAS,SAAS,OAAmC;AAC1D,QAAM,EAAE,aAAa,GAAG,YAAY,IAAI;AACxC,QAAM,EAAE,SAAS,GAAG,WAAW,IAAI,gBAAgB;AAEnD,SACE;AAAA,IAAC;AAAA;AAAA,MACE,GAAG;AAAA,MACH,GAAG;AAAA,MACH,GAAI,eAAe,EAAE,oBAAoB,YAAY;AAAA,MACrD,GAAI,WAAW,EAAE,gBAAgB,KAAK;AAAA,MACvC,WAAW;AAAA,QACT,MAAM;AAAA,QACN,MAAM,EAAE;AAAA,QACR,IAAI;AAAA,UACF,KAAK;AAAA,UACL,IAAI;AAAA,UACJ,QAAQ;AAAA,QACV,CAAC;AAAA,MACH;AAAA,MACA,MAAM;AAAA;AAAA,EACR;AAEJ;","names":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/components/FieldMessage.tsx"],"sourcesContent":["'use client'\n\nimport type { HTMLAttributes } from 'react'\nimport { cx, type RecipeVariantProps } 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 type FieldMessageRecipe = RecipeVariantProps<typeof fieldMessage>\nexport interface FieldMessageBaseProps\n extends HTMLAttributes<HTMLParagraphElement> {\n id: string\n}\nexport type FieldMessageProps = FieldMessageBaseProps & FieldMessageRecipe\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,UAAmC;AAC5C,SAAS,oBAAoB;AAgCzB;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":[]}
|
package/build/legacy/index.js
CHANGED
|
@@ -6,13 +6,13 @@ import {
|
|
|
6
6
|
} from "./chunk-BJXUBNF2.js";
|
|
7
7
|
import {
|
|
8
8
|
Textarea
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-TCO46FK7.js";
|
|
10
10
|
import {
|
|
11
11
|
Input
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-6SAA3NUE.js";
|
|
13
13
|
import {
|
|
14
14
|
Label
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-CINUA3C7.js";
|
|
16
16
|
import {
|
|
17
17
|
NavMenuLink
|
|
18
18
|
} from "./chunk-6DIGPXAD.js";
|
|
@@ -60,14 +60,14 @@ import {
|
|
|
60
60
|
} from "./chunk-2ATICEW3.js";
|
|
61
61
|
import {
|
|
62
62
|
FieldMessage
|
|
63
|
-
} from "./chunk-
|
|
63
|
+
} from "./chunk-VGHVH2T3.js";
|
|
64
64
|
import {
|
|
65
65
|
Field,
|
|
66
66
|
useFieldContext
|
|
67
67
|
} from "./chunk-ZAU4JVLL.js";
|
|
68
68
|
import {
|
|
69
69
|
IconButton
|
|
70
|
-
} from "./chunk-
|
|
70
|
+
} from "./chunk-SLHX5K6I.js";
|
|
71
71
|
export {
|
|
72
72
|
Button,
|
|
73
73
|
Field,
|
|
@@ -4,10 +4,13 @@ import { ButtonHTMLAttributes } from 'react';
|
|
|
4
4
|
import type { ConditionalValue } from '@cerberus/styled-system/types';
|
|
5
5
|
import { Context } from 'react';
|
|
6
6
|
import { ElementType } from 'react';
|
|
7
|
+
import { fieldMessage } from '@cerberus/styled-system/recipes';
|
|
7
8
|
import { HTMLAttributes } from 'react';
|
|
8
9
|
import { iconButton } from '@cerberus/styled-system/recipes';
|
|
10
|
+
import { input } from '@cerberus/styled-system/recipes';
|
|
9
11
|
import type { InputHTMLAttributes } from 'react';
|
|
10
12
|
import { JSX as JSX_2 } from 'react/jsx-runtime';
|
|
13
|
+
import { label } from '@cerberus/styled-system/recipes';
|
|
11
14
|
import { MutableRefObject } from 'react';
|
|
12
15
|
import { PropsWithChildren } from 'react';
|
|
13
16
|
import { ReactNode } from 'react';
|
|
@@ -89,16 +92,24 @@ declare function FieldMessage(props: FieldMessageProps): JSX_2.Element;
|
|
|
89
92
|
export { FieldMessage }
|
|
90
93
|
export { FieldMessage as FieldMessage_alias_1 }
|
|
91
94
|
|
|
92
|
-
|
|
93
|
-
* This module contains the FieldMessage component.
|
|
94
|
-
* @module
|
|
95
|
-
*/
|
|
96
|
-
declare interface FieldMessageProps extends HTMLAttributes<HTMLParagraphElement> {
|
|
95
|
+
declare interface FieldMessageBaseProps extends HTMLAttributes<HTMLParagraphElement> {
|
|
97
96
|
id: string;
|
|
98
97
|
}
|
|
98
|
+
export { FieldMessageBaseProps }
|
|
99
|
+
export { FieldMessageBaseProps as FieldMessageBaseProps_alias_1 }
|
|
100
|
+
|
|
101
|
+
declare type FieldMessageProps = FieldMessageBaseProps & FieldMessageRecipe;
|
|
99
102
|
export { FieldMessageProps }
|
|
100
103
|
export { FieldMessageProps as FieldMessageProps_alias_1 }
|
|
101
104
|
|
|
105
|
+
/**
|
|
106
|
+
* This module contains the FieldMessage component.
|
|
107
|
+
* @module
|
|
108
|
+
*/
|
|
109
|
+
declare type FieldMessageRecipe = RecipeVariantProps<typeof fieldMessage>;
|
|
110
|
+
export { FieldMessageRecipe }
|
|
111
|
+
export { FieldMessageRecipe as FieldMessageRecipe_alias_1 }
|
|
112
|
+
|
|
102
113
|
declare function getPosition(position: Positions): GetPositionResult;
|
|
103
114
|
export { getPosition }
|
|
104
115
|
export { getPosition as getPosition_alias_1 }
|
|
@@ -128,7 +139,7 @@ export { IconButtonProps as IconButtonProps_alias_1 }
|
|
|
128
139
|
*/
|
|
129
140
|
declare interface IconButtonRawProps extends ButtonHTMLAttributes<HTMLButtonElement> {
|
|
130
141
|
ariaLabel: string;
|
|
131
|
-
tooltipPosition?:
|
|
142
|
+
tooltipPosition?: Positions;
|
|
132
143
|
}
|
|
133
144
|
export { IconButtonRawProps }
|
|
134
145
|
export { IconButtonRawProps as IconButtonRawProps_alias_1 }
|
|
@@ -141,14 +152,21 @@ declare function Input(props: InputProps): JSX_2.Element;
|
|
|
141
152
|
export { Input }
|
|
142
153
|
export { Input as Input_alias_1 }
|
|
143
154
|
|
|
144
|
-
declare interface
|
|
155
|
+
declare interface InputBaseProps extends Omit<InputHTMLAttributes<HTMLInputElement>, 'id' | 'size'> {
|
|
145
156
|
describedBy?: string;
|
|
146
157
|
id: string;
|
|
147
|
-
size?: 'sm' | 'md' | 'lg';
|
|
148
158
|
}
|
|
159
|
+
export { InputBaseProps }
|
|
160
|
+
export { InputBaseProps as InputBaseProps_alias_1 }
|
|
161
|
+
|
|
162
|
+
declare type InputProps = InputBaseProps & InputRecipeProps;
|
|
149
163
|
export { InputProps }
|
|
150
164
|
export { InputProps as InputProps_alias_1 }
|
|
151
165
|
|
|
166
|
+
declare type InputRecipeProps = RecipeVariantProps<typeof input>;
|
|
167
|
+
export { InputRecipeProps }
|
|
168
|
+
export { InputRecipeProps as InputRecipeProps_alias_1 }
|
|
169
|
+
|
|
152
170
|
/**
|
|
153
171
|
* A screen ready friendly label component.
|
|
154
172
|
* @definition [ARIA Forms](https://www.a11yproject.com/checklist/#forms)
|
|
@@ -164,17 +182,25 @@ declare function Label(props: PropsWithChildren<LabelProps>): JSX_2.Element;
|
|
|
164
182
|
export { Label }
|
|
165
183
|
export { Label as Label_alias_1 }
|
|
166
184
|
|
|
167
|
-
|
|
168
|
-
* This module contains the Label component.
|
|
169
|
-
* @module
|
|
170
|
-
*/
|
|
171
|
-
declare interface LabelProps extends HTMLAttributes<HTMLLabelElement> {
|
|
185
|
+
declare interface LabelBaseProps extends HTMLAttributes<HTMLLabelElement> {
|
|
172
186
|
htmlFor: string;
|
|
173
187
|
hidden?: boolean;
|
|
174
188
|
}
|
|
189
|
+
export { LabelBaseProps }
|
|
190
|
+
export { LabelBaseProps as LabelBaseProps_alias_1 }
|
|
191
|
+
|
|
192
|
+
declare type LabelProps = LabelBaseProps & LabelRecipeProps;
|
|
175
193
|
export { LabelProps }
|
|
176
194
|
export { LabelProps as LabelProps_alias_1 }
|
|
177
195
|
|
|
196
|
+
/**
|
|
197
|
+
* This module contains the Label component.
|
|
198
|
+
* @module
|
|
199
|
+
*/
|
|
200
|
+
declare type LabelRecipeProps = RecipeVariantProps<typeof label>;
|
|
201
|
+
export { LabelRecipeProps }
|
|
202
|
+
export { LabelRecipeProps as LabelRecipeProps_alias_1 }
|
|
203
|
+
|
|
178
204
|
declare const MODE_KEY = "cerberus-mode";
|
|
179
205
|
export { MODE_KEY }
|
|
180
206
|
export { MODE_KEY as MODE_KEY_alias_1 }
|
|
@@ -457,10 +483,14 @@ export { Textarea as Textarea_alias_1 }
|
|
|
457
483
|
* This module contains the Textarea component.
|
|
458
484
|
* @module
|
|
459
485
|
*/
|
|
460
|
-
declare interface
|
|
486
|
+
declare interface TextareaBaseProps extends Omit<TextareaHTMLAttributes<HTMLTextAreaElement>, 'id'> {
|
|
461
487
|
describedBy?: string;
|
|
462
488
|
id: string;
|
|
463
489
|
}
|
|
490
|
+
export { TextareaBaseProps }
|
|
491
|
+
export { TextareaBaseProps as TextareaBaseProps_alias_1 }
|
|
492
|
+
|
|
493
|
+
declare type TextareaProps = InputRecipeProps & TextareaBaseProps;
|
|
464
494
|
export { TextareaProps }
|
|
465
495
|
export { TextareaProps as TextareaProps_alias_1 }
|
|
466
496
|
|
|
@@ -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, type RecipeVariantProps } from '@cerberus/styled-system/css'\nimport { useFieldContext } from '../context/field'\nimport { Show } from './Show'\n\nexport type InputRecipeProps = RecipeVariantProps<typeof input>\n\nexport interface InputBaseProps\n extends Omit<InputHTMLAttributes<HTMLInputElement>, 'id' | 'size'> {\n describedBy?: string\n id: string\n}\nexport type InputProps = InputBaseProps & InputRecipeProps\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,UAAmC;AAmBxC,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":[]}
|
|
@@ -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 { 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":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/components/IconButton.tsx"],"sourcesContent":["import type { ButtonHTMLAttributes } from 'react'\nimport { cx, type RecipeVariantProps } from '@cerberus/styled-system/css'\nimport { iconButton } from '@cerberus/styled-system/recipes'\nimport type { Positions } from '../types'\n\n/**\n * This module contains the Icon Button component.\n * @module\n */\n\nexport interface IconButtonRawProps\n extends ButtonHTMLAttributes<HTMLButtonElement> {\n ariaLabel: string\n tooltipPosition?: Positions\n}\nexport type IconButtonRecipeProps = RecipeVariantProps<typeof iconButton>\nexport type IconButtonProps = IconButtonRawProps & IconButtonRecipeProps\n\n/**\n * A component that allows the user to perform actions using an icon\n * @description https://github.com/omnifed/cerberus/blob/main/packages/react/src/components/IconButton.tsx\n */\nexport function IconButton(props: IconButtonProps): JSX.Element {\n const { ariaLabel, palette, usage, size, ...nativeProps } = props\n return (\n <button\n {...nativeProps}\n data-tooltip\n data-position={props.tooltipPosition ?? 'top'}\n aria-label={ariaLabel ?? 'Icon Button'}\n className={cx(\n nativeProps.className,\n iconButton({\n palette,\n usage,\n size,\n }),\n )}\n />\n )\n}\n"],"mappings":";AACA,SAAS,UAAmC;AAC5C,SAAS,kBAAkB;AAuBvB;AAHG,SAAS,WAAW,OAAqC;AAC9D,QAAM,EAAE,WAAW,SAAS,OAAO,MAAM,GAAG,YAAY,IAAI;AAC5D,SACE;AAAA,IAAC;AAAA;AAAA,MACE,GAAG;AAAA,MACJ,gBAAY;AAAA,MACZ,iBAAe,MAAM,mBAAmB;AAAA,MACxC,cAAY,aAAa;AAAA,MACzB,WAAW;AAAA,QACT,YAAY;AAAA,QACZ,WAAW;AAAA,UACT;AAAA,UACA;AAAA,UACA;AAAA,QACF,CAAC;AAAA,MACH;AAAA;AAAA,EACF;AAEJ;","names":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/components/Textarea.tsx"],"sourcesContent":["'use client'\n\nimport type { TextareaHTMLAttributes } from 'react'\nimport { css, cx } from '@cerberus/styled-system/css'\nimport { input } from '@cerberus/styled-system/recipes'\nimport { useFieldContext } from '../context/field'\nimport type { InputRecipeProps } from './Input'\n\n/**\n * This module contains the Textarea component.\n * @module\n */\n\nexport interface TextareaBaseProps\n extends Omit<TextareaHTMLAttributes<HTMLTextAreaElement>, 'id'> {\n describedBy?: string\n id: string\n}\nexport type TextareaProps = InputRecipeProps & TextareaBaseProps\n\n/**\n * A component that allows the user to input large blocks of text.\n * @description https://github.com/omnifed/cerberus/blob/main/packages/react/src/components/Textarea.tsx\n */\nexport function Textarea(props: TextareaProps): JSX.Element {\n const { describedBy, ...nativeProps } = props\n const { invalid, ...fieldState } = useFieldContext()\n\n return (\n <textarea\n {...nativeProps}\n {...fieldState}\n {...(describedBy && { 'aria-describedby': describedBy })}\n {...(invalid && { 'aria-invalid': true })}\n className={cx(\n props.className,\n input().input,\n css({\n pxi: '2',\n py: '2',\n resize: 'vertical',\n }),\n )}\n rows={4}\n />\n )\n}\n"],"mappings":";;;;;AAGA,SAAS,KAAK,UAAU;AACxB,SAAS,aAAa;AAyBlB;AALG,SAAS,SAAS,OAAmC;AAC1D,QAAM,EAAE,aAAa,GAAG,YAAY,IAAI;AACxC,QAAM,EAAE,SAAS,GAAG,WAAW,IAAI,gBAAgB;AAEnD,SACE;AAAA,IAAC;AAAA;AAAA,MACE,GAAG;AAAA,MACH,GAAG;AAAA,MACH,GAAI,eAAe,EAAE,oBAAoB,YAAY;AAAA,MACrD,GAAI,WAAW,EAAE,gBAAgB,KAAK;AAAA,MACvC,WAAW;AAAA,QACT,MAAM;AAAA,QACN,MAAM,EAAE;AAAA,QACR,IAAI;AAAA,UACF,KAAK;AAAA,UACL,IAAI;AAAA,UACJ,QAAQ;AAAA,QACV,CAAC;AAAA,MACH;AAAA,MACA,MAAM;AAAA;AAAA,EACR;AAEJ;","names":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/components/FieldMessage.tsx"],"sourcesContent":["'use client'\n\nimport type { HTMLAttributes } from 'react'\nimport { cx, type RecipeVariantProps } 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 type FieldMessageRecipe = RecipeVariantProps<typeof fieldMessage>\nexport interface FieldMessageBaseProps\n extends HTMLAttributes<HTMLParagraphElement> {\n id: string\n}\nexport type FieldMessageProps = FieldMessageBaseProps & FieldMessageRecipe\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,UAAmC;AAC5C,SAAS,oBAAoB;AAgCzB;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":[]}
|
package/build/modern/index.js
CHANGED
|
@@ -6,13 +6,13 @@ import {
|
|
|
6
6
|
} from "./chunk-23OSBT4M.js";
|
|
7
7
|
import {
|
|
8
8
|
Textarea
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-TCO46FK7.js";
|
|
10
10
|
import {
|
|
11
11
|
Input
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-6SAA3NUE.js";
|
|
13
13
|
import {
|
|
14
14
|
Label
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-CINUA3C7.js";
|
|
16
16
|
import {
|
|
17
17
|
NavMenuLink
|
|
18
18
|
} from "./chunk-6DIGPXAD.js";
|
|
@@ -60,14 +60,14 @@ import {
|
|
|
60
60
|
} from "./chunk-2ATICEW3.js";
|
|
61
61
|
import {
|
|
62
62
|
FieldMessage
|
|
63
|
-
} from "./chunk-
|
|
63
|
+
} from "./chunk-VGHVH2T3.js";
|
|
64
64
|
import {
|
|
65
65
|
Field,
|
|
66
66
|
useFieldContext
|
|
67
67
|
} from "./chunk-ZAU4JVLL.js";
|
|
68
68
|
import {
|
|
69
69
|
IconButton
|
|
70
|
-
} from "./chunk-
|
|
70
|
+
} from "./chunk-SLHX5K6I.js";
|
|
71
71
|
export {
|
|
72
72
|
Button,
|
|
73
73
|
Field,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cerberus-design/react",
|
|
3
|
-
"version": "0.5.2-next-
|
|
3
|
+
"version": "0.5.2-next-41ff124",
|
|
4
4
|
"description": "The Cerberus Design React component library.",
|
|
5
5
|
"browserslist": "> 0.25%, not dead",
|
|
6
6
|
"sideEffects": false,
|
|
@@ -21,8 +21,8 @@
|
|
|
21
21
|
"react": "^18",
|
|
22
22
|
"react-dom": "^18",
|
|
23
23
|
"tsup": "^8.1.0",
|
|
24
|
-
"@cerberus-design/
|
|
25
|
-
"@cerberus-design/
|
|
24
|
+
"@cerberus-design/styled-system": "0.5.2-next-41ff124",
|
|
25
|
+
"@cerberus-design/configs": "0.0.0"
|
|
26
26
|
},
|
|
27
27
|
"publishConfig": {
|
|
28
28
|
"access": "public"
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use client'
|
|
2
2
|
|
|
3
3
|
import type { HTMLAttributes } from 'react'
|
|
4
|
-
import { cx } from '@cerberus/styled-system/css'
|
|
4
|
+
import { cx, type RecipeVariantProps } from '@cerberus/styled-system/css'
|
|
5
5
|
import { fieldMessage } from '@cerberus/styled-system/recipes'
|
|
6
6
|
import { useFieldContext } from '../context/field'
|
|
7
7
|
|
|
@@ -10,10 +10,12 @@ import { useFieldContext } from '../context/field'
|
|
|
10
10
|
* @module
|
|
11
11
|
*/
|
|
12
12
|
|
|
13
|
-
export
|
|
13
|
+
export type FieldMessageRecipe = RecipeVariantProps<typeof fieldMessage>
|
|
14
|
+
export interface FieldMessageBaseProps
|
|
14
15
|
extends HTMLAttributes<HTMLParagraphElement> {
|
|
15
16
|
id: string
|
|
16
17
|
}
|
|
18
|
+
export type FieldMessageProps = FieldMessageBaseProps & FieldMessageRecipe
|
|
17
19
|
|
|
18
20
|
/**
|
|
19
21
|
* A component that provides feedback about the field.
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { ButtonHTMLAttributes } from 'react'
|
|
2
2
|
import { cx, type RecipeVariantProps } from '@cerberus/styled-system/css'
|
|
3
3
|
import { iconButton } from '@cerberus/styled-system/recipes'
|
|
4
|
+
import type { Positions } from '../types'
|
|
4
5
|
|
|
5
6
|
/**
|
|
6
7
|
* This module contains the Icon Button component.
|
|
@@ -10,7 +11,7 @@ import { iconButton } from '@cerberus/styled-system/recipes'
|
|
|
10
11
|
export interface IconButtonRawProps
|
|
11
12
|
extends ButtonHTMLAttributes<HTMLButtonElement> {
|
|
12
13
|
ariaLabel: string
|
|
13
|
-
tooltipPosition?:
|
|
14
|
+
tooltipPosition?: Positions
|
|
14
15
|
}
|
|
15
16
|
export type IconButtonRecipeProps = RecipeVariantProps<typeof iconButton>
|
|
16
17
|
export type IconButtonProps = IconButtonRawProps & IconButtonRecipeProps
|
package/src/components/Input.tsx
CHANGED
|
@@ -3,16 +3,18 @@
|
|
|
3
3
|
import type { InputHTMLAttributes } from 'react'
|
|
4
4
|
import { WarningFilled } from '@cerberus/icons'
|
|
5
5
|
import { input } from '@cerberus/styled-system/recipes'
|
|
6
|
-
import { cx } from '@cerberus/styled-system/css'
|
|
6
|
+
import { cx, type RecipeVariantProps } from '@cerberus/styled-system/css'
|
|
7
7
|
import { useFieldContext } from '../context/field'
|
|
8
8
|
import { Show } from './Show'
|
|
9
9
|
|
|
10
|
-
export
|
|
10
|
+
export type InputRecipeProps = RecipeVariantProps<typeof input>
|
|
11
|
+
|
|
12
|
+
export interface InputBaseProps
|
|
11
13
|
extends Omit<InputHTMLAttributes<HTMLInputElement>, 'id' | 'size'> {
|
|
12
14
|
describedBy?: string
|
|
13
15
|
id: string
|
|
14
|
-
size?: 'sm' | 'md' | 'lg'
|
|
15
16
|
}
|
|
17
|
+
export type InputProps = InputBaseProps & InputRecipeProps
|
|
16
18
|
|
|
17
19
|
export function Input(props: InputProps) {
|
|
18
20
|
const { describedBy, size, ...nativeProps } = props
|
package/src/components/Label.tsx
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
import type { HTMLAttributes, PropsWithChildren } from 'react'
|
|
4
4
|
import { label } from '@cerberus/styled-system/recipes'
|
|
5
|
-
import { css, cx } from '@cerberus/styled-system/css'
|
|
5
|
+
import { css, cx, type RecipeVariantProps } from '@cerberus/styled-system/css'
|
|
6
6
|
import { useFieldContext } from '../context/field'
|
|
7
7
|
import { Show } from './Show'
|
|
8
8
|
import { hstack } from '@cerberus/styled-system/patterns'
|
|
@@ -12,10 +12,12 @@ import { hstack } from '@cerberus/styled-system/patterns'
|
|
|
12
12
|
* @module
|
|
13
13
|
*/
|
|
14
14
|
|
|
15
|
-
export
|
|
15
|
+
export type LabelRecipeProps = RecipeVariantProps<typeof label>
|
|
16
|
+
export interface LabelBaseProps extends HTMLAttributes<HTMLLabelElement> {
|
|
16
17
|
htmlFor: string
|
|
17
18
|
hidden?: boolean
|
|
18
19
|
}
|
|
20
|
+
export type LabelProps = LabelBaseProps & LabelRecipeProps
|
|
19
21
|
|
|
20
22
|
/**
|
|
21
23
|
* A screen ready friendly label component.
|
|
@@ -4,17 +4,19 @@ import type { TextareaHTMLAttributes } from 'react'
|
|
|
4
4
|
import { css, cx } from '@cerberus/styled-system/css'
|
|
5
5
|
import { input } from '@cerberus/styled-system/recipes'
|
|
6
6
|
import { useFieldContext } from '../context/field'
|
|
7
|
+
import type { InputRecipeProps } from './Input'
|
|
7
8
|
|
|
8
9
|
/**
|
|
9
10
|
* This module contains the Textarea component.
|
|
10
11
|
* @module
|
|
11
12
|
*/
|
|
12
13
|
|
|
13
|
-
export interface
|
|
14
|
+
export interface TextareaBaseProps
|
|
14
15
|
extends Omit<TextareaHTMLAttributes<HTMLTextAreaElement>, 'id'> {
|
|
15
16
|
describedBy?: string
|
|
16
17
|
id: string
|
|
17
18
|
}
|
|
19
|
+
export type TextareaProps = InputRecipeProps & TextareaBaseProps
|
|
18
20
|
|
|
19
21
|
/**
|
|
20
22
|
* A component that allows the user to input large blocks of text.
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/components/Textarea.tsx"],"sourcesContent":["'use client'\n\nimport type { TextareaHTMLAttributes } from 'react'\nimport { css, cx } from '@cerberus/styled-system/css'\nimport { input } from '@cerberus/styled-system/recipes'\nimport { useFieldContext } from '../context/field'\n\n/**\n * This module contains the Textarea component.\n * @module\n */\n\nexport interface TextareaProps\n extends Omit<TextareaHTMLAttributes<HTMLTextAreaElement>, 'id'> {\n describedBy?: string\n id: string\n}\n\n/**\n * A component that allows the user to input large blocks of text.\n * @description https://github.com/omnifed/cerberus/blob/main/packages/react/src/components/Textarea.tsx\n */\nexport function Textarea(props: TextareaProps): JSX.Element {\n const { describedBy, ...nativeProps } = props\n const { invalid, ...fieldState } = useFieldContext()\n\n return (\n <textarea\n {...nativeProps}\n {...fieldState}\n {...(describedBy && { 'aria-describedby': describedBy })}\n {...(invalid && { 'aria-invalid': true })}\n className={cx(\n props.className,\n input().input,\n css({\n pxi: '2',\n py: '2',\n resize: 'vertical',\n }),\n )}\n rows={4}\n />\n )\n}\n"],"mappings":";;;;;AAGA,SAAS,KAAK,UAAU;AACxB,SAAS,aAAa;AAuBlB;AALG,SAAS,SAAS,OAAmC;AAC1D,QAAM,EAAE,aAAa,GAAG,YAAY,IAAI;AACxC,QAAM,EAAE,SAAS,GAAG,WAAW,IAAI,gBAAgB;AAEnD,SACE;AAAA,IAAC;AAAA;AAAA,MACE,GAAG;AAAA,MACH,GAAG;AAAA,MACH,GAAI,eAAe,EAAE,oBAAoB,YAAY;AAAA,MACrD,GAAI,WAAW,EAAE,gBAAgB,KAAK;AAAA,MACvC,WAAW;AAAA,QACT,MAAM;AAAA,QACN,MAAM,EAAE;AAAA,QACR,IAAI;AAAA,UACF,KAAK;AAAA,UACL,IAAI;AAAA,UACJ,QAAQ;AAAA,QACV,CAAC;AAAA,MACH;AAAA,MACA,MAAM;AAAA;AAAA,EACR;AAEJ;","names":[]}
|
|
@@ -1 +0,0 @@
|
|
|
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":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/components/IconButton.tsx"],"sourcesContent":["import type { ButtonHTMLAttributes } from 'react'\nimport { cx, type RecipeVariantProps } from '@cerberus/styled-system/css'\nimport { iconButton } from '@cerberus/styled-system/recipes'\n\n/**\n * This module contains the Icon Button component.\n * @module\n */\n\nexport interface IconButtonRawProps\n extends ButtonHTMLAttributes<HTMLButtonElement> {\n ariaLabel: string\n tooltipPosition?: 'top' | 'bottom' | 'left' | 'right'\n}\nexport type IconButtonRecipeProps = RecipeVariantProps<typeof iconButton>\nexport type IconButtonProps = IconButtonRawProps & IconButtonRecipeProps\n\n/**\n * A component that allows the user to perform actions using an icon\n * @description https://github.com/omnifed/cerberus/blob/main/packages/react/src/components/IconButton.tsx\n */\nexport function IconButton(props: IconButtonProps): JSX.Element {\n const { ariaLabel, palette, usage, size, ...nativeProps } = props\n return (\n <button\n {...nativeProps}\n data-tooltip\n data-position={props.tooltipPosition ?? 'top'}\n aria-label={ariaLabel ?? 'Icon Button'}\n className={cx(\n nativeProps.className,\n iconButton({\n palette,\n usage,\n size,\n }),\n )}\n />\n )\n}\n"],"mappings":";AACA,SAAS,UAAmC;AAC5C,SAAS,kBAAkB;AAsBvB;AAHG,SAAS,WAAW,OAAqC;AAC9D,QAAM,EAAE,WAAW,SAAS,OAAO,MAAM,GAAG,YAAY,IAAI;AAC5D,SACE;AAAA,IAAC;AAAA;AAAA,MACE,GAAG;AAAA,MACJ,gBAAY;AAAA,MACZ,iBAAe,MAAM,mBAAmB;AAAA,MACxC,cAAY,aAAa;AAAA,MACzB,WAAW;AAAA,QACT,YAAY;AAAA,QACZ,WAAW;AAAA,UACT;AAAA,UACA;AAAA,UACA;AAAA,QACF,CAAC;AAAA,MACH;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 } 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":[]}
|
|
@@ -1 +0,0 @@
|
|
|
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 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/components/Textarea.tsx"],"sourcesContent":["'use client'\n\nimport type { TextareaHTMLAttributes } from 'react'\nimport { css, cx } from '@cerberus/styled-system/css'\nimport { input } from '@cerberus/styled-system/recipes'\nimport { useFieldContext } from '../context/field'\n\n/**\n * This module contains the Textarea component.\n * @module\n */\n\nexport interface TextareaProps\n extends Omit<TextareaHTMLAttributes<HTMLTextAreaElement>, 'id'> {\n describedBy?: string\n id: string\n}\n\n/**\n * A component that allows the user to input large blocks of text.\n * @description https://github.com/omnifed/cerberus/blob/main/packages/react/src/components/Textarea.tsx\n */\nexport function Textarea(props: TextareaProps): JSX.Element {\n const { describedBy, ...nativeProps } = props\n const { invalid, ...fieldState } = useFieldContext()\n\n return (\n <textarea\n {...nativeProps}\n {...fieldState}\n {...(describedBy && { 'aria-describedby': describedBy })}\n {...(invalid && { 'aria-invalid': true })}\n className={cx(\n props.className,\n input().input,\n css({\n pxi: '2',\n py: '2',\n resize: 'vertical',\n }),\n )}\n rows={4}\n />\n )\n}\n"],"mappings":";;;;;AAGA,SAAS,KAAK,UAAU;AACxB,SAAS,aAAa;AAuBlB;AALG,SAAS,SAAS,OAAmC;AAC1D,QAAM,EAAE,aAAa,GAAG,YAAY,IAAI;AACxC,QAAM,EAAE,SAAS,GAAG,WAAW,IAAI,gBAAgB;AAEnD,SACE;AAAA,IAAC;AAAA;AAAA,MACE,GAAG;AAAA,MACH,GAAG;AAAA,MACH,GAAI,eAAe,EAAE,oBAAoB,YAAY;AAAA,MACrD,GAAI,WAAW,EAAE,gBAAgB,KAAK;AAAA,MACvC,WAAW;AAAA,QACT,MAAM;AAAA,QACN,MAAM,EAAE;AAAA,QACR,IAAI;AAAA,UACF,KAAK;AAAA,UACL,IAAI;AAAA,UACJ,QAAQ;AAAA,QACV,CAAC;AAAA,MACH;AAAA,MACA,MAAM;AAAA;AAAA,EACR;AAEJ;","names":[]}
|
|
@@ -1 +0,0 @@
|
|
|
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":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/components/IconButton.tsx"],"sourcesContent":["import type { ButtonHTMLAttributes } from 'react'\nimport { cx, type RecipeVariantProps } from '@cerberus/styled-system/css'\nimport { iconButton } from '@cerberus/styled-system/recipes'\n\n/**\n * This module contains the Icon Button component.\n * @module\n */\n\nexport interface IconButtonRawProps\n extends ButtonHTMLAttributes<HTMLButtonElement> {\n ariaLabel: string\n tooltipPosition?: 'top' | 'bottom' | 'left' | 'right'\n}\nexport type IconButtonRecipeProps = RecipeVariantProps<typeof iconButton>\nexport type IconButtonProps = IconButtonRawProps & IconButtonRecipeProps\n\n/**\n * A component that allows the user to perform actions using an icon\n * @description https://github.com/omnifed/cerberus/blob/main/packages/react/src/components/IconButton.tsx\n */\nexport function IconButton(props: IconButtonProps): JSX.Element {\n const { ariaLabel, palette, usage, size, ...nativeProps } = props\n return (\n <button\n {...nativeProps}\n data-tooltip\n data-position={props.tooltipPosition ?? 'top'}\n aria-label={ariaLabel ?? 'Icon Button'}\n className={cx(\n nativeProps.className,\n iconButton({\n palette,\n usage,\n size,\n }),\n )}\n />\n )\n}\n"],"mappings":";AACA,SAAS,UAAmC;AAC5C,SAAS,kBAAkB;AAsBvB;AAHG,SAAS,WAAW,OAAqC;AAC9D,QAAM,EAAE,WAAW,SAAS,OAAO,MAAM,GAAG,YAAY,IAAI;AAC5D,SACE;AAAA,IAAC;AAAA;AAAA,MACE,GAAG;AAAA,MACJ,gBAAY;AAAA,MACZ,iBAAe,MAAM,mBAAmB;AAAA,MACxC,cAAY,aAAa;AAAA,MACzB,WAAW;AAAA,QACT,YAAY;AAAA,QACZ,WAAW;AAAA,UACT;AAAA,UACA;AAAA,UACA;AAAA,QACF,CAAC;AAAA,MACH;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 } 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":[]}
|
|
@@ -1 +0,0 @@
|
|
|
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":[]}
|