@cerberus-design/react 0.5.2-next-e9386b3 → 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 +83 -45
- package/build/{modern/chunk-LQHCCI4H.js → legacy/chunk-2ATICEW3.js} +1 -1
- package/build/legacy/chunk-2ATICEW3.js.map +1 -0
- 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-QILSE3K3.js → legacy/chunk-BJXUBNF2.js} +3 -2
- package/build/legacy/chunk-BJXUBNF2.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-GQSXLQOD.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/legacy/{chunk-YVUZSAJG.js → chunk-VGHVH2T3.js} +1 -1
- package/build/legacy/chunk-VGHVH2T3.js.map +1 -0
- package/build/legacy/components/Button.js +1 -1
- 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/Tag.js +1 -1
- package/build/legacy/components/Textarea.js +1 -1
- package/build/legacy/index.js +7 -7
- package/build/modern/_tsup-dts-rollup.d.ts +83 -45
- package/build/{legacy/chunk-QILSE3K3.js → modern/chunk-23OSBT4M.js} +3 -2
- package/build/modern/chunk-23OSBT4M.js.map +1 -0
- package/build/{legacy/chunk-LQHCCI4H.js → modern/chunk-2ATICEW3.js} +1 -1
- package/build/modern/chunk-2ATICEW3.js.map +1 -0
- 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-GQSXLQOD.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/modern/{chunk-YVUZSAJG.js → chunk-VGHVH2T3.js} +1 -1
- package/build/modern/chunk-VGHVH2T3.js.map +1 -0
- package/build/modern/components/Button.js +1 -1
- 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/Tag.js +1 -1
- package/build/modern/components/Textarea.js +1 -1
- package/build/modern/index.js +7 -7
- package/package.json +3 -3
- package/src/components/Button.tsx +3 -6
- package/src/components/FieldMessage.tsx +4 -2
- package/src/components/IconButton.tsx +6 -8
- package/src/components/Input.tsx +5 -3
- package/src/components/Label.tsx +4 -2
- package/src/components/Tag.tsx +20 -17
- package/src/components/Textarea.tsx +3 -1
- package/build/legacy/chunk-5TBINKAO.js.map +0 -1
- package/build/legacy/chunk-GQSXLQOD.js.map +0 -1
- package/build/legacy/chunk-KO7LBJGB.js.map +0 -1
- package/build/legacy/chunk-LQHCCI4H.js.map +0 -1
- package/build/legacy/chunk-PFY74S3Z.js.map +0 -1
- package/build/legacy/chunk-QILSE3K3.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-GQSXLQOD.js.map +0 -1
- package/build/modern/chunk-KO7LBJGB.js.map +0 -1
- package/build/modern/chunk-LQHCCI4H.js.map +0 -1
- package/build/modern/chunk-PFY74S3Z.js.map +0 -1
- package/build/modern/chunk-QILSE3K3.js.map +0 -1
- package/build/modern/chunk-YVUZSAJG.js.map +0 -1
|
@@ -1,15 +1,23 @@
|
|
|
1
1
|
import type { AnchorHTMLAttributes } from 'react';
|
|
2
|
+
import { button } from '@cerberus/styled-system/recipes';
|
|
2
3
|
import { ButtonHTMLAttributes } from 'react';
|
|
3
4
|
import type { ConditionalValue } from '@cerberus/styled-system/types';
|
|
4
5
|
import { Context } from 'react';
|
|
5
6
|
import { ElementType } from 'react';
|
|
7
|
+
import { fieldMessage } from '@cerberus/styled-system/recipes';
|
|
6
8
|
import { HTMLAttributes } from 'react';
|
|
9
|
+
import { iconButton } from '@cerberus/styled-system/recipes';
|
|
10
|
+
import { input } from '@cerberus/styled-system/recipes';
|
|
7
11
|
import type { InputHTMLAttributes } from 'react';
|
|
8
12
|
import { JSX as JSX_2 } from 'react/jsx-runtime';
|
|
13
|
+
import { label } from '@cerberus/styled-system/recipes';
|
|
9
14
|
import { MutableRefObject } from 'react';
|
|
10
15
|
import { PropsWithChildren } from 'react';
|
|
11
16
|
import { ReactNode } from 'react';
|
|
17
|
+
import { RecipeVariantProps } from '@cerberus/styled-system/css';
|
|
18
|
+
import type { RecipeVariantProps as RecipeVariantProps_2 } from '@cerberus/styled-system/types';
|
|
12
19
|
import { RefObject } from 'react';
|
|
20
|
+
import { tag } from '@cerberus/styled-system/recipes';
|
|
13
21
|
import type { TextareaHTMLAttributes } from 'react';
|
|
14
22
|
|
|
15
23
|
/**
|
|
@@ -24,20 +32,16 @@ export { Button as Button_alias_1 }
|
|
|
24
32
|
* This module contains the Button component.
|
|
25
33
|
* @module
|
|
26
34
|
*/
|
|
27
|
-
declare
|
|
28
|
-
palette?: 'action' | 'danger';
|
|
29
|
-
usage?: 'filled' | 'outlined' | 'text';
|
|
30
|
-
shape?: 'sharp' | 'rounded';
|
|
31
|
-
}
|
|
35
|
+
declare type ButtonProps = ButtonHTMLAttributes<HTMLButtonElement> & RecipeVariantProps<typeof button>;
|
|
32
36
|
export { ButtonProps }
|
|
33
37
|
export { ButtonProps as ButtonProps_alias_1 }
|
|
34
38
|
|
|
35
|
-
declare
|
|
36
|
-
palette?:
|
|
37
|
-
shape?: 'pill';
|
|
39
|
+
declare type ClickableTagProps = HTMLAttributes<HTMLSpanElement> & {
|
|
40
|
+
palette?: ConditionalValue<'neutral' | 'info' | 'success' | 'warning' | 'danger'>;
|
|
38
41
|
onClick: () => void;
|
|
39
|
-
|
|
40
|
-
|
|
42
|
+
shape: 'pill';
|
|
43
|
+
usage: 'filled';
|
|
44
|
+
};
|
|
41
45
|
export { ClickableTagProps }
|
|
42
46
|
export { ClickableTagProps as ClickableTagProps_alias_1 }
|
|
43
47
|
|
|
@@ -88,16 +92,24 @@ declare function FieldMessage(props: FieldMessageProps): JSX_2.Element;
|
|
|
88
92
|
export { FieldMessage }
|
|
89
93
|
export { FieldMessage as FieldMessage_alias_1 }
|
|
90
94
|
|
|
91
|
-
|
|
92
|
-
* This module contains the FieldMessage component.
|
|
93
|
-
* @module
|
|
94
|
-
*/
|
|
95
|
-
declare interface FieldMessageProps extends HTMLAttributes<HTMLParagraphElement> {
|
|
95
|
+
declare interface FieldMessageBaseProps extends HTMLAttributes<HTMLParagraphElement> {
|
|
96
96
|
id: string;
|
|
97
97
|
}
|
|
98
|
+
export { FieldMessageBaseProps }
|
|
99
|
+
export { FieldMessageBaseProps as FieldMessageBaseProps_alias_1 }
|
|
100
|
+
|
|
101
|
+
declare type FieldMessageProps = FieldMessageBaseProps & FieldMessageRecipe;
|
|
98
102
|
export { FieldMessageProps }
|
|
99
103
|
export { FieldMessageProps as FieldMessageProps_alias_1 }
|
|
100
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
|
+
|
|
101
113
|
declare function getPosition(position: Positions): GetPositionResult;
|
|
102
114
|
export { getPosition }
|
|
103
115
|
export { getPosition as getPosition_alias_1 }
|
|
@@ -117,33 +129,44 @@ declare function IconButton(props: IconButtonProps): JSX.Element;
|
|
|
117
129
|
export { IconButton }
|
|
118
130
|
export { IconButton as IconButton_alias_1 }
|
|
119
131
|
|
|
132
|
+
declare type IconButtonProps = IconButtonRawProps & IconButtonRecipeProps;
|
|
133
|
+
export { IconButtonProps }
|
|
134
|
+
export { IconButtonProps as IconButtonProps_alias_1 }
|
|
135
|
+
|
|
120
136
|
/**
|
|
121
137
|
* This module contains the Icon Button component.
|
|
122
138
|
* @module
|
|
123
139
|
*/
|
|
124
|
-
declare interface
|
|
140
|
+
declare interface IconButtonRawProps extends ButtonHTMLAttributes<HTMLButtonElement> {
|
|
125
141
|
ariaLabel: string;
|
|
126
|
-
|
|
127
|
-
usage?: ButtonProps['usage'];
|
|
128
|
-
shape?: 'circle';
|
|
129
|
-
size?: 'sm' | 'lg';
|
|
130
|
-
tooltipPosition?: 'top' | 'bottom' | 'left' | 'right';
|
|
142
|
+
tooltipPosition?: Positions;
|
|
131
143
|
}
|
|
132
|
-
export {
|
|
133
|
-
export {
|
|
144
|
+
export { IconButtonRawProps }
|
|
145
|
+
export { IconButtonRawProps as IconButtonRawProps_alias_1 }
|
|
146
|
+
|
|
147
|
+
declare type IconButtonRecipeProps = RecipeVariantProps<typeof iconButton>;
|
|
148
|
+
export { IconButtonRecipeProps }
|
|
149
|
+
export { IconButtonRecipeProps as IconButtonRecipeProps_alias_1 }
|
|
134
150
|
|
|
135
151
|
declare function Input(props: InputProps): JSX_2.Element;
|
|
136
152
|
export { Input }
|
|
137
153
|
export { Input as Input_alias_1 }
|
|
138
154
|
|
|
139
|
-
declare interface
|
|
155
|
+
declare interface InputBaseProps extends Omit<InputHTMLAttributes<HTMLInputElement>, 'id' | 'size'> {
|
|
140
156
|
describedBy?: string;
|
|
141
157
|
id: string;
|
|
142
|
-
size?: 'sm' | 'md' | 'lg';
|
|
143
158
|
}
|
|
159
|
+
export { InputBaseProps }
|
|
160
|
+
export { InputBaseProps as InputBaseProps_alias_1 }
|
|
161
|
+
|
|
162
|
+
declare type InputProps = InputBaseProps & InputRecipeProps;
|
|
144
163
|
export { InputProps }
|
|
145
164
|
export { InputProps as InputProps_alias_1 }
|
|
146
165
|
|
|
166
|
+
declare type InputRecipeProps = RecipeVariantProps<typeof input>;
|
|
167
|
+
export { InputRecipeProps }
|
|
168
|
+
export { InputRecipeProps as InputRecipeProps_alias_1 }
|
|
169
|
+
|
|
147
170
|
/**
|
|
148
171
|
* A screen ready friendly label component.
|
|
149
172
|
* @definition [ARIA Forms](https://www.a11yproject.com/checklist/#forms)
|
|
@@ -159,17 +182,25 @@ declare function Label(props: PropsWithChildren<LabelProps>): JSX_2.Element;
|
|
|
159
182
|
export { Label }
|
|
160
183
|
export { Label as Label_alias_1 }
|
|
161
184
|
|
|
162
|
-
|
|
163
|
-
* This module contains the Label component.
|
|
164
|
-
* @module
|
|
165
|
-
*/
|
|
166
|
-
declare interface LabelProps extends HTMLAttributes<HTMLLabelElement> {
|
|
185
|
+
declare interface LabelBaseProps extends HTMLAttributes<HTMLLabelElement> {
|
|
167
186
|
htmlFor: string;
|
|
168
187
|
hidden?: boolean;
|
|
169
188
|
}
|
|
189
|
+
export { LabelBaseProps }
|
|
190
|
+
export { LabelBaseProps as LabelBaseProps_alias_1 }
|
|
191
|
+
|
|
192
|
+
declare type LabelProps = LabelBaseProps & LabelRecipeProps;
|
|
170
193
|
export { LabelProps }
|
|
171
194
|
export { LabelProps as LabelProps_alias_1 }
|
|
172
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
|
+
|
|
173
204
|
declare const MODE_KEY = "cerberus-mode";
|
|
174
205
|
export { MODE_KEY }
|
|
175
206
|
export { MODE_KEY as MODE_KEY_alias_1 }
|
|
@@ -263,14 +294,6 @@ declare type NavTriggerRef = RefObject<HTMLButtonElement>;
|
|
|
263
294
|
export { NavTriggerRef }
|
|
264
295
|
export { NavTriggerRef as NavTriggerRef_alias_1 }
|
|
265
296
|
|
|
266
|
-
/**
|
|
267
|
-
* This module contains the tag component.
|
|
268
|
-
* @module
|
|
269
|
-
*/
|
|
270
|
-
declare type NonActionablePalette = ConditionalValue<'neutral' | 'info' | 'success' | 'warning' | 'danger'>;
|
|
271
|
-
export { NonActionablePalette }
|
|
272
|
-
export { NonActionablePalette as NonActionablePalette_alias_1 }
|
|
273
|
-
|
|
274
297
|
declare type Positions = 'top' | 'right' | 'bottom' | 'left';
|
|
275
298
|
export { Positions }
|
|
276
299
|
export { Positions as Positions_alias_1 }
|
|
@@ -296,6 +319,12 @@ declare interface ShowProps {
|
|
|
296
319
|
export { ShowProps }
|
|
297
320
|
export { ShowProps as ShowProps_alias_1 }
|
|
298
321
|
|
|
322
|
+
declare type StaticTagProps = HTMLAttributes<HTMLSpanElement> & TagRecipeProps & {
|
|
323
|
+
onClick?: never;
|
|
324
|
+
};
|
|
325
|
+
export { StaticTagProps }
|
|
326
|
+
export { StaticTagProps as StaticTagProps_alias_1 }
|
|
327
|
+
|
|
299
328
|
/**
|
|
300
329
|
* The Tab component provides a tab element to be used in a TabList.
|
|
301
330
|
* @definition [ARIA Target Size](https://www.w3.org/WAI/WCAG21/Understanding/target-size.html#:~:text=Understanding%20SC%202.5.,%3ATarget%20Size%20(Level%20AAA)&text=The%20size%20of%20the%20target,Equivalent)
|
|
@@ -420,23 +449,28 @@ export { TabsProps as TabsProps_alias_1 }
|
|
|
420
449
|
|
|
421
450
|
/**
|
|
422
451
|
* The Tag component is used to display a meta descriptions.
|
|
452
|
+
* @definition [Tag docs](https://cerberus.digitalu.design/react/tags)
|
|
423
453
|
* @example
|
|
424
454
|
* ```tsx
|
|
425
455
|
* <Tag>Tag</Tag>
|
|
426
456
|
* ```
|
|
427
457
|
*/
|
|
428
|
-
declare function Tag(props: PropsWithChildren<TagProps
|
|
458
|
+
declare function Tag(props: PropsWithChildren<TagProps>): JSX.Element;
|
|
429
459
|
export { Tag }
|
|
430
460
|
export { Tag as Tag_alias_1 }
|
|
431
461
|
|
|
432
|
-
declare
|
|
433
|
-
palette?: NonActionablePalette;
|
|
434
|
-
shape?: 'rounded' | 'pill';
|
|
435
|
-
usage?: 'filled' | 'outline';
|
|
436
|
-
}
|
|
462
|
+
declare type TagProps = StaticTagProps | ClickableTagProps;
|
|
437
463
|
export { TagProps }
|
|
438
464
|
export { TagProps as TagProps_alias_1 }
|
|
439
465
|
|
|
466
|
+
/**
|
|
467
|
+
* This module contains the tag component.
|
|
468
|
+
* @module
|
|
469
|
+
*/
|
|
470
|
+
declare type TagRecipeProps = RecipeVariantProps_2<typeof tag>;
|
|
471
|
+
export { TagRecipeProps }
|
|
472
|
+
export { TagRecipeProps as TagRecipeProps_alias_1 }
|
|
473
|
+
|
|
440
474
|
/**
|
|
441
475
|
* A component that allows the user to input large blocks of text.
|
|
442
476
|
* @description https://github.com/omnifed/cerberus/blob/main/packages/react/src/components/Textarea.tsx
|
|
@@ -449,10 +483,14 @@ export { Textarea as Textarea_alias_1 }
|
|
|
449
483
|
* This module contains the Textarea component.
|
|
450
484
|
* @module
|
|
451
485
|
*/
|
|
452
|
-
declare interface
|
|
486
|
+
declare interface TextareaBaseProps extends Omit<TextareaHTMLAttributes<HTMLTextAreaElement>, 'id'> {
|
|
453
487
|
describedBy?: string;
|
|
454
488
|
id: string;
|
|
455
489
|
}
|
|
490
|
+
export { TextareaBaseProps }
|
|
491
|
+
export { TextareaBaseProps as TextareaBaseProps_alias_1 }
|
|
492
|
+
|
|
493
|
+
declare type TextareaProps = InputRecipeProps & TextareaBaseProps;
|
|
456
494
|
export { TextareaProps }
|
|
457
495
|
export { TextareaProps as TextareaProps_alias_1 }
|
|
458
496
|
|
|
@@ -8,7 +8,8 @@ import { css, cx } from "@cerberus/styled-system/css";
|
|
|
8
8
|
import { iconButton, tag } from "@cerberus/styled-system/recipes";
|
|
9
9
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
10
10
|
function Tag(props) {
|
|
11
|
-
const {
|
|
11
|
+
const { shape: initShape, onClick, usage, ...nativeProps } = props;
|
|
12
|
+
const palette = props?.palette ?? "neutral";
|
|
12
13
|
const isClosable = Boolean(onClick);
|
|
13
14
|
const shape = isClosable ? "pill" : initShape;
|
|
14
15
|
const closableStyles = isClosable ? css({
|
|
@@ -52,4 +53,4 @@ function Tag(props) {
|
|
|
52
53
|
export {
|
|
53
54
|
Tag
|
|
54
55
|
};
|
|
55
|
-
//# sourceMappingURL=chunk-
|
|
56
|
+
//# sourceMappingURL=chunk-23OSBT4M.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/components/Tag.tsx"],"sourcesContent":["import type { HTMLAttributes, PropsWithChildren } from 'react'\nimport { Close } from '@cerberus/icons'\nimport { Show } from './Show'\nimport { css, cx } from '@cerberus/styled-system/css'\nimport { iconButton, tag } from '@cerberus/styled-system/recipes'\nimport type {\n ConditionalValue,\n RecipeVariantProps,\n} from '@cerberus/styled-system/types'\n\n/**\n * This module contains the tag component.\n * @module\n */\n\nexport type TagRecipeProps = RecipeVariantProps<typeof tag>\nexport type StaticTagProps = HTMLAttributes<HTMLSpanElement> &\n TagRecipeProps & {\n onClick?: never\n }\nexport type ClickableTagProps = HTMLAttributes<HTMLSpanElement> & {\n palette?: ConditionalValue<\n 'neutral' | 'info' | 'success' | 'warning' | 'danger'\n >\n onClick: () => void\n shape: 'pill'\n usage: 'filled'\n}\nexport type TagProps = StaticTagProps | ClickableTagProps\n\n/**\n * The Tag component is used to display a meta descriptions.\n * @definition [Tag docs](https://cerberus.digitalu.design/react/tags)\n * @example\n * ```tsx\n * <Tag>Tag</Tag>\n * ```\n */\nexport function Tag(props: PropsWithChildren<TagProps>): JSX.Element {\n const { shape: initShape, onClick, usage, ...nativeProps } = props\n const palette = props?.palette ?? 'neutral'\n const isClosable = Boolean(onClick)\n const shape = isClosable ? 'pill' : initShape\n const closableStyles = isClosable\n ? css({\n bgColor: 'action.bg.active',\n color: 'action.text.initial',\n paddingInlineEnd: '0',\n })\n : ''\n\n return (\n <span\n {...nativeProps}\n className={cx(\n nativeProps.className,\n tag({\n palette,\n shape,\n usage,\n }),\n closableStyles,\n )}\n >\n {props.children}\n\n <Show when={isClosable}>\n <button\n aria-label=\"Close\"\n className={iconButton({\n palette: 'action',\n usage: 'filled',\n size: 'sm',\n })}\n onClick={onClick}\n >\n <Close />\n </button>\n </Show>\n </span>\n )\n}\n"],"mappings":";;;;;AACA,SAAS,aAAa;AAEtB,SAAS,KAAK,UAAU;AACxB,SAAS,YAAY,WAAW;AAgD5B,SAwBM,KAxBN;AAdG,SAAS,IAAI,OAAiD;AACnE,QAAM,EAAE,OAAO,WAAW,SAAS,OAAO,GAAG,YAAY,IAAI;AAC7D,QAAM,UAAU,OAAO,WAAW;AAClC,QAAM,aAAa,QAAQ,OAAO;AAClC,QAAM,QAAQ,aAAa,SAAS;AACpC,QAAM,iBAAiB,aACnB,IAAI;AAAA,IACF,SAAS;AAAA,IACT,OAAO;AAAA,IACP,kBAAkB;AAAA,EACpB,CAAC,IACD;AAEJ,SACE;AAAA,IAAC;AAAA;AAAA,MACE,GAAG;AAAA,MACJ,WAAW;AAAA,QACT,YAAY;AAAA,QACZ,IAAI;AAAA,UACF;AAAA,UACA;AAAA,UACA;AAAA,QACF,CAAC;AAAA,QACD;AAAA,MACF;AAAA,MAEC;AAAA,cAAM;AAAA,QAEP,oBAAC,QAAK,MAAM,YACV;AAAA,UAAC;AAAA;AAAA,YACC,cAAW;AAAA,YACX,WAAW,WAAW;AAAA,cACpB,SAAS;AAAA,cACT,OAAO;AAAA,cACP,MAAM;AAAA,YACR,CAAC;AAAA,YACD;AAAA,YAEA,8BAAC,SAAM;AAAA;AAAA,QACT,GACF;AAAA;AAAA;AAAA,EACF;AAEJ;","names":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/components/Button.tsx"],"sourcesContent":["import type { ButtonHTMLAttributes } from 'react'\nimport { cx, type RecipeVariantProps } from '@cerberus/styled-system/css'\nimport { button } from '@cerberus/styled-system/recipes'\n\n/**\n * This module contains the Button component.\n * @module\n */\n\nexport type ButtonProps = ButtonHTMLAttributes<HTMLButtonElement> &\n RecipeVariantProps<typeof button>\n\n/**\n * A component that allows the user to perform actions\n * @description https://github.com/omnifed/cerberus/blob/main/packages/react/src/components/Button.tsx\n */\nexport function Button(props: ButtonProps): JSX.Element {\n const { palette, usage, shape, ...nativeProps } = props\n return (\n <button\n {...nativeProps}\n className={cx(\n nativeProps.className,\n button({\n palette,\n usage,\n shape,\n }),\n )}\n />\n )\n}\n"],"mappings":";AACA,SAAS,UAAmC;AAC5C,SAAS,cAAc;AAiBnB;AAHG,SAAS,OAAO,OAAiC;AACtD,QAAM,EAAE,SAAS,OAAO,OAAO,GAAG,YAAY,IAAI;AAClD,SACE;AAAA,IAAC;AAAA;AAAA,MACE,GAAG;AAAA,MACJ,WAAW;AAAA,QACT,YAAY;AAAA,QACZ,OAAO;AAAA,UACL;AAAA,UACA;AAAA,UACA;AAAA,QACF,CAAC;AAAA,MACH;AAAA;AAAA,EACF;AAEJ;","names":[]}
|
|
@@ -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
|
@@ -3,16 +3,16 @@ import {
|
|
|
3
3
|
} from "./chunk-YJCWUN33.js";
|
|
4
4
|
import {
|
|
5
5
|
Tag
|
|
6
|
-
} from "./chunk-
|
|
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";
|
|
@@ -57,17 +57,17 @@ import {
|
|
|
57
57
|
} from "./chunk-SXXWC6UD.js";
|
|
58
58
|
import {
|
|
59
59
|
Button
|
|
60
|
-
} from "./chunk-
|
|
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,5 +1,5 @@
|
|
|
1
1
|
import type { ButtonHTMLAttributes } from 'react'
|
|
2
|
-
import { cx } from '@cerberus/styled-system/css'
|
|
2
|
+
import { cx, type RecipeVariantProps } from '@cerberus/styled-system/css'
|
|
3
3
|
import { button } from '@cerberus/styled-system/recipes'
|
|
4
4
|
|
|
5
5
|
/**
|
|
@@ -7,11 +7,8 @@ import { button } from '@cerberus/styled-system/recipes'
|
|
|
7
7
|
* @module
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
|
-
export
|
|
11
|
-
|
|
12
|
-
usage?: 'filled' | 'outlined' | 'text'
|
|
13
|
-
shape?: 'sharp' | 'rounded'
|
|
14
|
-
}
|
|
10
|
+
export type ButtonProps = ButtonHTMLAttributes<HTMLButtonElement> &
|
|
11
|
+
RecipeVariantProps<typeof button>
|
|
15
12
|
|
|
16
13
|
/**
|
|
17
14
|
* A component that allows the user to perform actions
|
|
@@ -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,22 +1,20 @@
|
|
|
1
1
|
import type { ButtonHTMLAttributes } from 'react'
|
|
2
|
-
import { cx } from '@cerberus/styled-system/css'
|
|
2
|
+
import { cx, type RecipeVariantProps } from '@cerberus/styled-system/css'
|
|
3
3
|
import { iconButton } from '@cerberus/styled-system/recipes'
|
|
4
|
-
import type {
|
|
4
|
+
import type { Positions } from '../types'
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* This module contains the Icon Button component.
|
|
8
8
|
* @module
|
|
9
9
|
*/
|
|
10
10
|
|
|
11
|
-
export interface
|
|
11
|
+
export interface IconButtonRawProps
|
|
12
12
|
extends ButtonHTMLAttributes<HTMLButtonElement> {
|
|
13
13
|
ariaLabel: string
|
|
14
|
-
|
|
15
|
-
usage?: ButtonProps['usage']
|
|
16
|
-
shape?: 'circle'
|
|
17
|
-
size?: 'sm' | 'lg'
|
|
18
|
-
tooltipPosition?: 'top' | 'bottom' | 'left' | 'right'
|
|
14
|
+
tooltipPosition?: Positions
|
|
19
15
|
}
|
|
16
|
+
export type IconButtonRecipeProps = RecipeVariantProps<typeof iconButton>
|
|
17
|
+
export type IconButtonProps = IconButtonRawProps & IconButtonRecipeProps
|
|
20
18
|
|
|
21
19
|
/**
|
|
22
20
|
* A component that allows the user to perform actions using an icon
|
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.
|