@cerberus-design/react 0.5.2 → 0.6.0
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 +157 -49
- package/build/legacy/aria-helpers/tabs.aria.js +1 -1
- package/build/legacy/{chunk-XFWARXLU.js → chunk-2ATICEW3.js} +1 -1
- package/build/legacy/chunk-2ATICEW3.js.map +1 -0
- package/build/legacy/chunk-3CBN7U25.js +24 -0
- package/build/legacy/chunk-3CBN7U25.js.map +1 -0
- package/build/{modern/chunk-R4H3352X.js → legacy/chunk-4O4QFF4S.js} +2 -3
- package/build/legacy/{chunk-R4H3352X.js.map → chunk-4O4QFF4S.js.map} +1 -1
- package/build/legacy/chunk-5MNCW677.js +11 -0
- package/build/legacy/chunk-5MNCW677.js.map +1 -0
- package/build/{modern/chunk-7BXBIDZB.js → legacy/chunk-5XNLWIZO.js} +11 -8
- package/build/legacy/chunk-5XNLWIZO.js.map +1 -0
- package/build/{modern/chunk-JA4IX7GN.js → legacy/chunk-6DIGPXAD.js} +2 -2
- package/build/legacy/chunk-734PGVLT.js +58 -0
- package/build/legacy/chunk-734PGVLT.js.map +1 -0
- package/build/legacy/{chunk-WSQTX34C.js → chunk-G2QMBSK5.js} +2 -2
- package/build/{modern/chunk-OXVNTE4A.js → legacy/chunk-HE3HFKYU.js} +8 -7
- package/build/legacy/chunk-HE3HFKYU.js.map +1 -0
- package/build/legacy/{chunk-MJB3V6J4.js → chunk-RPZAPUCF.js} +3 -4
- package/build/legacy/{chunk-MJB3V6J4.js.map → chunk-RPZAPUCF.js.map} +1 -1
- package/build/legacy/{chunk-BT2B5C7M.js → chunk-S7HBD2A7.js} +2 -3
- package/build/legacy/{chunk-BT2B5C7M.js.map → chunk-S7HBD2A7.js.map} +1 -1
- package/build/legacy/chunk-SCQVXJBT.js +22 -0
- package/build/legacy/chunk-SCQVXJBT.js.map +1 -0
- package/build/{modern/chunk-NIMWIOIA.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/chunk-WE3JNSNO.js +33 -0
- package/build/legacy/chunk-WE3JNSNO.js.map +1 -0
- package/build/legacy/{chunk-LD5ZV46F.js → chunk-X4YQ27D5.js} +14 -7
- package/build/legacy/chunk-X4YQ27D5.js.map +1 -0
- package/build/legacy/{chunk-MYRKQVDI.js → chunk-YA2UV2AB.js} +2 -2
- package/build/legacy/{chunk-SVZU6LPF.js → chunk-YJCWUN33.js} +2 -2
- 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 +4 -2
- package/build/legacy/components/Label.js +2 -2
- package/build/legacy/components/NavMenuLink.js +2 -2
- package/build/legacy/components/NavMenuList.js +2 -2
- package/build/legacy/components/NavMenuTrigger.js +2 -2
- package/build/legacy/components/Radio.js +9 -0
- package/build/legacy/components/Radio.js.map +1 -0
- package/build/legacy/components/Show.js +1 -1
- package/build/legacy/components/Tab.js +2 -2
- package/build/legacy/components/TabPanel.js +2 -2
- package/build/legacy/components/Tag.js +2 -2
- package/build/legacy/components/Textarea.js +1 -1
- package/build/legacy/components/Toggle.js +11 -0
- package/build/legacy/components/Toggle.js.map +1 -0
- package/build/legacy/config/cerbIcons.js +7 -0
- package/build/legacy/config/cerbIcons.js.map +1 -0
- package/build/legacy/config/defineIcons.js +10 -0
- package/build/legacy/config/defineIcons.js.map +1 -0
- package/build/legacy/hooks/useToggle.js +8 -0
- package/build/legacy/hooks/useToggle.js.map +1 -0
- package/build/legacy/index.js +48 -29
- package/build/legacy/noExternals.d.ts +1 -0
- package/build/modern/_tsup-dts-rollup.d.ts +157 -49
- package/build/modern/aria-helpers/tabs.aria.js +1 -1
- package/build/modern/{chunk-XFWARXLU.js → chunk-2ATICEW3.js} +1 -1
- package/build/modern/chunk-2ATICEW3.js.map +1 -0
- package/build/modern/chunk-3CBN7U25.js +24 -0
- package/build/modern/chunk-3CBN7U25.js.map +1 -0
- package/build/{legacy/chunk-R4H3352X.js → modern/chunk-4O4QFF4S.js} +2 -3
- package/build/modern/{chunk-R4H3352X.js.map → chunk-4O4QFF4S.js.map} +1 -1
- package/build/modern/chunk-5MNCW677.js +11 -0
- package/build/modern/chunk-5MNCW677.js.map +1 -0
- package/build/{legacy/chunk-JA4IX7GN.js → modern/chunk-6DIGPXAD.js} +2 -2
- package/build/modern/chunk-734PGVLT.js +58 -0
- package/build/modern/chunk-734PGVLT.js.map +1 -0
- package/build/modern/{chunk-WSQTX34C.js → chunk-G2QMBSK5.js} +2 -2
- package/build/{legacy/chunk-OXVNTE4A.js → modern/chunk-HE3HFKYU.js} +8 -7
- package/build/modern/chunk-HE3HFKYU.js.map +1 -0
- package/build/modern/chunk-QEA6N6TN.js +22 -0
- package/build/modern/chunk-QEA6N6TN.js.map +1 -0
- package/build/modern/{chunk-MJB3V6J4.js → chunk-RPZAPUCF.js} +3 -4
- package/build/modern/{chunk-MJB3V6J4.js.map → chunk-RPZAPUCF.js.map} +1 -1
- package/build/modern/{chunk-BT2B5C7M.js → chunk-S7HBD2A7.js} +2 -3
- package/build/modern/{chunk-BT2B5C7M.js.map → chunk-S7HBD2A7.js.map} +1 -1
- package/build/{legacy/chunk-NIMWIOIA.js → modern/chunk-SLHX5K6I.js} +1 -1
- package/build/modern/chunk-SLHX5K6I.js.map +1 -0
- package/build/{legacy/chunk-7BXBIDZB.js → modern/chunk-SLIOCQBZ.js} +11 -8
- package/build/modern/chunk-SLIOCQBZ.js.map +1 -0
- package/build/modern/{chunk-IQP6HSC4.js → chunk-SUP7U42W.js} +2 -2
- 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/chunk-WE3JNSNO.js +33 -0
- package/build/modern/chunk-WE3JNSNO.js.map +1 -0
- package/build/modern/{chunk-LD5ZV46F.js → chunk-X4YQ27D5.js} +14 -7
- package/build/modern/chunk-X4YQ27D5.js.map +1 -0
- package/build/modern/{chunk-SVZU6LPF.js → chunk-YJCWUN33.js} +2 -2
- 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 +4 -2
- package/build/modern/components/Label.js +2 -2
- package/build/modern/components/NavMenuLink.js +2 -2
- package/build/modern/components/NavMenuList.js +2 -2
- package/build/modern/components/NavMenuTrigger.js +2 -2
- package/build/modern/components/Radio.js +9 -0
- package/build/modern/components/Radio.js.map +1 -0
- package/build/modern/components/Show.js +1 -1
- package/build/modern/components/Tab.js +2 -2
- package/build/modern/components/TabPanel.js +2 -2
- package/build/modern/components/Tag.js +2 -2
- package/build/modern/components/Textarea.js +1 -1
- package/build/modern/components/Toggle.js +11 -0
- package/build/modern/components/Toggle.js.map +1 -0
- package/build/modern/config/cerbIcons.js +7 -0
- package/build/modern/config/cerbIcons.js.map +1 -0
- package/build/modern/config/defineIcons.js +10 -0
- package/build/modern/config/defineIcons.js.map +1 -0
- package/build/modern/hooks/useToggle.js +8 -0
- package/build/modern/hooks/useToggle.js.map +1 -0
- package/build/modern/index.js +48 -29
- package/build/modern/noExternals.d.ts +1 -0
- package/package.json +7 -6
- package/src/components/Button.tsx +3 -6
- package/src/components/FieldMessage.tsx +4 -2
- package/src/components/IconButton.tsx +6 -9
- package/src/components/Input.tsx +21 -7
- package/src/components/Label.tsx +9 -6
- package/src/components/Radio.tsx +35 -0
- package/src/components/Tag.tsx +27 -24
- package/src/components/Textarea.tsx +3 -1
- package/src/components/Toggle.tsx +55 -0
- package/src/config/cerbIcons.ts +12 -0
- package/src/config/defineIcons.ts +19 -0
- package/src/hooks/useToggle.ts +30 -0
- package/src/index.ts +7 -0
- package/build/legacy/aria-helpers/nav-menu.aria.d.ts +0 -2
- package/build/legacy/aria-helpers/tabs.aria.d.ts +0 -1
- package/build/legacy/chunk-5TBINKAO.js.map +0 -1
- package/build/legacy/chunk-7BXBIDZB.js.map +0 -1
- package/build/legacy/chunk-LD5ZV46F.js.map +0 -1
- package/build/legacy/chunk-NIMWIOIA.js.map +0 -1
- package/build/legacy/chunk-OXVNTE4A.js.map +0 -1
- package/build/legacy/chunk-XFWARXLU.js.map +0 -1
- package/build/legacy/chunk-YVUZSAJG.js.map +0 -1
- package/build/legacy/components/Button.d.ts +0 -2
- package/build/legacy/components/FieldMessage.d.ts +0 -2
- package/build/legacy/components/IconButton.d.ts +0 -3
- package/build/legacy/components/Input.d.ts +0 -2
- package/build/legacy/components/Label.d.ts +0 -2
- package/build/legacy/components/NavMenuLink.d.ts +0 -2
- package/build/legacy/components/NavMenuList.d.ts +0 -3
- package/build/legacy/components/NavMenuTrigger.d.ts +0 -2
- package/build/legacy/components/Show.d.ts +0 -2
- package/build/legacy/components/Tab.d.ts +0 -2
- package/build/legacy/components/TabList.d.ts +0 -2
- package/build/legacy/components/TabPanel.d.ts +0 -2
- package/build/legacy/components/Tag.d.ts +0 -4
- package/build/legacy/components/Textarea.d.ts +0 -2
- package/build/legacy/context/field.d.ts +0 -3
- package/build/legacy/context/navMenu.d.ts +0 -5
- package/build/legacy/context/tabs.d.ts +0 -5
- package/build/legacy/context/theme.d.ts +0 -8
- package/build/legacy/hooks/useTheme.d.ts +0 -1
- package/build/legacy/index.d.ts +0 -58
- package/build/legacy/types.d.ts +0 -1
- package/build/modern/aria-helpers/nav-menu.aria.d.ts +0 -2
- package/build/modern/aria-helpers/tabs.aria.d.ts +0 -1
- package/build/modern/chunk-5TBINKAO.js.map +0 -1
- package/build/modern/chunk-7BXBIDZB.js.map +0 -1
- package/build/modern/chunk-LD5ZV46F.js.map +0 -1
- package/build/modern/chunk-NIMWIOIA.js.map +0 -1
- package/build/modern/chunk-OXVNTE4A.js.map +0 -1
- package/build/modern/chunk-XFWARXLU.js.map +0 -1
- package/build/modern/chunk-YVUZSAJG.js.map +0 -1
- package/build/modern/components/Button.d.ts +0 -2
- package/build/modern/components/FieldMessage.d.ts +0 -2
- package/build/modern/components/IconButton.d.ts +0 -3
- package/build/modern/components/Input.d.ts +0 -2
- package/build/modern/components/Label.d.ts +0 -2
- package/build/modern/components/NavMenuLink.d.ts +0 -2
- package/build/modern/components/NavMenuList.d.ts +0 -3
- package/build/modern/components/NavMenuTrigger.d.ts +0 -2
- package/build/modern/components/Show.d.ts +0 -2
- package/build/modern/components/Tab.d.ts +0 -2
- package/build/modern/components/TabList.d.ts +0 -2
- package/build/modern/components/TabPanel.d.ts +0 -2
- package/build/modern/components/Tag.d.ts +0 -4
- package/build/modern/components/Textarea.d.ts +0 -2
- package/build/modern/context/field.d.ts +0 -3
- package/build/modern/context/navMenu.d.ts +0 -5
- package/build/modern/context/tabs.d.ts +0 -5
- package/build/modern/context/theme.d.ts +0 -8
- package/build/modern/hooks/useTheme.d.ts +0 -1
- package/build/modern/index.d.ts +0 -58
- package/build/modern/types.d.ts +0 -1
- /package/build/legacy/{chunk-JA4IX7GN.js.map → chunk-6DIGPXAD.js.map} +0 -0
- /package/build/legacy/{chunk-WSQTX34C.js.map → chunk-G2QMBSK5.js.map} +0 -0
- /package/build/legacy/{chunk-MYRKQVDI.js.map → chunk-YA2UV2AB.js.map} +0 -0
- /package/build/legacy/{chunk-SVZU6LPF.js.map → chunk-YJCWUN33.js.map} +0 -0
- /package/build/modern/{chunk-JA4IX7GN.js.map → chunk-6DIGPXAD.js.map} +0 -0
- /package/build/modern/{chunk-WSQTX34C.js.map → chunk-G2QMBSK5.js.map} +0 -0
- /package/build/modern/{chunk-IQP6HSC4.js.map → chunk-SUP7U42W.js.map} +0 -0
- /package/build/modern/{chunk-SVZU6LPF.js.map → chunk-YJCWUN33.js.map} +0 -0
|
@@ -1,16 +1,32 @@
|
|
|
1
1
|
import type { AnchorHTMLAttributes } from 'react';
|
|
2
|
+
import { button } from '@cerberus/styled-system/recipes';
|
|
2
3
|
import { ButtonHTMLAttributes } from 'react';
|
|
3
|
-
import
|
|
4
|
+
import { CarbonIconType } from '@cerberus/icons';
|
|
5
|
+
import { ChangeEvent } from 'react';
|
|
4
6
|
import { Context } from 'react';
|
|
5
7
|
import { ElementType } from 'react';
|
|
8
|
+
import { fieldMessage } from '@cerberus/styled-system/recipes';
|
|
6
9
|
import { HTMLAttributes } from 'react';
|
|
10
|
+
import { iconButton } from '@cerberus/styled-system/recipes';
|
|
11
|
+
import { input } from '@cerberus/styled-system/recipes';
|
|
7
12
|
import type { InputHTMLAttributes } from 'react';
|
|
8
13
|
import { JSX as JSX_2 } from 'react/jsx-runtime';
|
|
14
|
+
import { label } from '@cerberus/styled-system/recipes';
|
|
9
15
|
import { MutableRefObject } from 'react';
|
|
10
16
|
import { PropsWithChildren } from 'react';
|
|
17
|
+
import { radio } from '@cerberus-design/styled-system/recipes';
|
|
11
18
|
import { ReactNode } from 'react';
|
|
19
|
+
import { RecipeVariantProps } from '@cerberus/styled-system/css';
|
|
20
|
+
import type { RecipeVariantProps as RecipeVariantProps_2 } from '@cerberus-design/styled-system/types';
|
|
21
|
+
import type { RecipeVariantProps as RecipeVariantProps_3 } from '@cerberus/styled-system/types';
|
|
12
22
|
import { RefObject } from 'react';
|
|
23
|
+
import { tag } from '@cerberus/styled-system/recipes';
|
|
13
24
|
import type { TextareaHTMLAttributes } from 'react';
|
|
25
|
+
import { ToggleVariantProps } from '@cerberus-design/styled-system/recipes';
|
|
26
|
+
|
|
27
|
+
declare let $cerberusIcons: DefinedIcons;
|
|
28
|
+
export { $cerberusIcons }
|
|
29
|
+
export { $cerberusIcons as $cerberusIcons_alias_1 }
|
|
14
30
|
|
|
15
31
|
/**
|
|
16
32
|
* A component that allows the user to perform actions
|
|
@@ -24,20 +40,17 @@ export { Button as Button_alias_1 }
|
|
|
24
40
|
* This module contains the Button component.
|
|
25
41
|
* @module
|
|
26
42
|
*/
|
|
27
|
-
declare
|
|
28
|
-
palette?: 'action' | 'danger';
|
|
29
|
-
usage?: 'filled' | 'outline' | 'text';
|
|
30
|
-
shape?: 'sharp' | 'rounded';
|
|
31
|
-
}
|
|
43
|
+
declare type ButtonProps = ButtonHTMLAttributes<HTMLButtonElement> & RecipeVariantProps<typeof button>;
|
|
32
44
|
export { ButtonProps }
|
|
33
45
|
export { ButtonProps as ButtonProps_alias_1 }
|
|
34
46
|
|
|
35
|
-
declare
|
|
36
|
-
|
|
37
|
-
|
|
47
|
+
declare type ClickableTagProps = HTMLAttributes<HTMLSpanElement> & {
|
|
48
|
+
gradient?: never;
|
|
49
|
+
palette?: never;
|
|
38
50
|
onClick: () => void;
|
|
39
|
-
|
|
40
|
-
|
|
51
|
+
shape: 'pill';
|
|
52
|
+
usage: 'filled';
|
|
53
|
+
};
|
|
41
54
|
export { ClickableTagProps }
|
|
42
55
|
export { ClickableTagProps as ClickableTagProps_alias_1 }
|
|
43
56
|
|
|
@@ -53,10 +66,21 @@ declare type CustomThemes<K extends string = DefaultThemes> = 'cerberus' | K;
|
|
|
53
66
|
export { CustomThemes }
|
|
54
67
|
export { CustomThemes as CustomThemes_alias_1 }
|
|
55
68
|
|
|
69
|
+
export declare const defaultIcons: DefinedIcons;
|
|
70
|
+
|
|
56
71
|
declare type DefaultThemes = 'cerberus';
|
|
57
72
|
export { DefaultThemes }
|
|
58
73
|
export { DefaultThemes as DefaultThemes_alias_1 }
|
|
59
74
|
|
|
75
|
+
export declare interface DefinedIcons {
|
|
76
|
+
invalid: CarbonIconType | ElementType;
|
|
77
|
+
toggleChecked: CarbonIconType | ElementType;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
declare function defineIcons(icons: DefinedIcons): DefinedIcons;
|
|
81
|
+
export { defineIcons }
|
|
82
|
+
export { defineIcons as defineIcons_alias_1 }
|
|
83
|
+
|
|
60
84
|
declare function Field(props: PropsWithChildren<FieldContextValue>): JSX.Element;
|
|
61
85
|
export { Field }
|
|
62
86
|
export { Field as Field_alias_1 }
|
|
@@ -88,16 +112,24 @@ declare function FieldMessage(props: FieldMessageProps): JSX_2.Element;
|
|
|
88
112
|
export { FieldMessage }
|
|
89
113
|
export { FieldMessage as FieldMessage_alias_1 }
|
|
90
114
|
|
|
91
|
-
|
|
92
|
-
* This module contains the FieldMessage component.
|
|
93
|
-
* @module
|
|
94
|
-
*/
|
|
95
|
-
declare interface FieldMessageProps extends HTMLAttributes<HTMLParagraphElement> {
|
|
115
|
+
declare interface FieldMessageBaseProps extends HTMLAttributes<HTMLParagraphElement> {
|
|
96
116
|
id: string;
|
|
97
117
|
}
|
|
118
|
+
export { FieldMessageBaseProps }
|
|
119
|
+
export { FieldMessageBaseProps as FieldMessageBaseProps_alias_1 }
|
|
120
|
+
|
|
121
|
+
declare type FieldMessageProps = FieldMessageBaseProps & FieldMessageRecipe;
|
|
98
122
|
export { FieldMessageProps }
|
|
99
123
|
export { FieldMessageProps as FieldMessageProps_alias_1 }
|
|
100
124
|
|
|
125
|
+
/**
|
|
126
|
+
* This module contains the FieldMessage component.
|
|
127
|
+
* @module
|
|
128
|
+
*/
|
|
129
|
+
declare type FieldMessageRecipe = RecipeVariantProps<typeof fieldMessage>;
|
|
130
|
+
export { FieldMessageRecipe }
|
|
131
|
+
export { FieldMessageRecipe as FieldMessageRecipe_alias_1 }
|
|
132
|
+
|
|
101
133
|
declare function getPosition(position: Positions): GetPositionResult;
|
|
102
134
|
export { getPosition }
|
|
103
135
|
export { getPosition as getPosition_alias_1 }
|
|
@@ -117,14 +149,7 @@ declare function IconButton(props: IconButtonProps): JSX.Element;
|
|
|
117
149
|
export { IconButton }
|
|
118
150
|
export { IconButton as IconButton_alias_1 }
|
|
119
151
|
|
|
120
|
-
declare
|
|
121
|
-
ariaLabel: string;
|
|
122
|
-
palette?: ButtonProps['palette'];
|
|
123
|
-
usage?: IconButtonUsage;
|
|
124
|
-
shape?: 'circle';
|
|
125
|
-
size?: 'sm' | 'lg';
|
|
126
|
-
tooltipPosition?: 'top' | 'bottom' | 'left' | 'right';
|
|
127
|
-
}
|
|
152
|
+
declare type IconButtonProps = IconButtonRawProps & IconButtonRecipeProps;
|
|
128
153
|
export { IconButtonProps }
|
|
129
154
|
export { IconButtonProps as IconButtonProps_alias_1 }
|
|
130
155
|
|
|
@@ -132,22 +157,38 @@ export { IconButtonProps as IconButtonProps_alias_1 }
|
|
|
132
157
|
* This module contains the Icon Button component.
|
|
133
158
|
* @module
|
|
134
159
|
*/
|
|
135
|
-
declare
|
|
136
|
-
|
|
137
|
-
|
|
160
|
+
declare interface IconButtonRawProps extends ButtonHTMLAttributes<HTMLButtonElement> {
|
|
161
|
+
ariaLabel: string;
|
|
162
|
+
tooltipPosition?: Positions;
|
|
163
|
+
}
|
|
164
|
+
export { IconButtonRawProps }
|
|
165
|
+
export { IconButtonRawProps as IconButtonRawProps_alias_1 }
|
|
166
|
+
|
|
167
|
+
declare type IconButtonRecipeProps = RecipeVariantProps<typeof iconButton>;
|
|
168
|
+
export { IconButtonRecipeProps }
|
|
169
|
+
export { IconButtonRecipeProps as IconButtonRecipeProps_alias_1 }
|
|
138
170
|
|
|
139
171
|
declare function Input(props: InputProps): JSX_2.Element;
|
|
140
172
|
export { Input }
|
|
141
173
|
export { Input as Input_alias_1 }
|
|
142
174
|
|
|
143
|
-
declare interface
|
|
175
|
+
declare interface InputBaseProps extends Omit<InputHTMLAttributes<HTMLInputElement>, 'id' | 'size'> {
|
|
144
176
|
describedBy?: string;
|
|
145
177
|
id: string;
|
|
146
|
-
|
|
178
|
+
startIcon?: ReactNode;
|
|
179
|
+
endIcon?: ReactNode;
|
|
147
180
|
}
|
|
181
|
+
export { InputBaseProps }
|
|
182
|
+
export { InputBaseProps as InputBaseProps_alias_1 }
|
|
183
|
+
|
|
184
|
+
declare type InputProps = InputBaseProps & InputRecipeProps;
|
|
148
185
|
export { InputProps }
|
|
149
186
|
export { InputProps as InputProps_alias_1 }
|
|
150
187
|
|
|
188
|
+
declare type InputRecipeProps = RecipeVariantProps<typeof input>;
|
|
189
|
+
export { InputRecipeProps }
|
|
190
|
+
export { InputRecipeProps as InputRecipeProps_alias_1 }
|
|
191
|
+
|
|
151
192
|
/**
|
|
152
193
|
* A screen ready friendly label component.
|
|
153
194
|
* @definition [ARIA Forms](https://www.a11yproject.com/checklist/#forms)
|
|
@@ -163,17 +204,25 @@ declare function Label(props: PropsWithChildren<LabelProps>): JSX_2.Element;
|
|
|
163
204
|
export { Label }
|
|
164
205
|
export { Label as Label_alias_1 }
|
|
165
206
|
|
|
166
|
-
|
|
167
|
-
* This module contains the Label component.
|
|
168
|
-
* @module
|
|
169
|
-
*/
|
|
170
|
-
declare interface LabelProps extends HTMLAttributes<HTMLLabelElement> {
|
|
207
|
+
declare interface LabelBaseProps extends HTMLAttributes<HTMLLabelElement> {
|
|
171
208
|
htmlFor: string;
|
|
172
209
|
hidden?: boolean;
|
|
173
210
|
}
|
|
211
|
+
export { LabelBaseProps }
|
|
212
|
+
export { LabelBaseProps as LabelBaseProps_alias_1 }
|
|
213
|
+
|
|
214
|
+
declare type LabelProps = LabelBaseProps & LabelRecipeProps;
|
|
174
215
|
export { LabelProps }
|
|
175
216
|
export { LabelProps as LabelProps_alias_1 }
|
|
176
217
|
|
|
218
|
+
/**
|
|
219
|
+
* This module contains the Label component.
|
|
220
|
+
* @module
|
|
221
|
+
*/
|
|
222
|
+
declare type LabelRecipeProps = RecipeVariantProps<typeof label>;
|
|
223
|
+
export { LabelRecipeProps }
|
|
224
|
+
export { LabelRecipeProps as LabelRecipeProps_alias_1 }
|
|
225
|
+
|
|
177
226
|
declare const MODE_KEY = "cerberus-mode";
|
|
178
227
|
export { MODE_KEY }
|
|
179
228
|
export { MODE_KEY as MODE_KEY_alias_1 }
|
|
@@ -267,18 +316,28 @@ declare type NavTriggerRef = RefObject<HTMLButtonElement>;
|
|
|
267
316
|
export { NavTriggerRef }
|
|
268
317
|
export { NavTriggerRef as NavTriggerRef_alias_1 }
|
|
269
318
|
|
|
270
|
-
/**
|
|
271
|
-
* This module contains the tag component.
|
|
272
|
-
* @module
|
|
273
|
-
*/
|
|
274
|
-
declare type NonActionablePalette = ConditionalValue<'neutral' | 'info' | 'success' | 'warning' | 'danger'>;
|
|
275
|
-
export { NonActionablePalette }
|
|
276
|
-
export { NonActionablePalette as NonActionablePalette_alias_1 }
|
|
277
|
-
|
|
278
319
|
declare type Positions = 'top' | 'right' | 'bottom' | 'left';
|
|
279
320
|
export { Positions }
|
|
280
321
|
export { Positions as Positions_alias_1 }
|
|
281
322
|
|
|
323
|
+
declare function Radio(props: PropsWithChildren<RadioProps>): JSX_2.Element;
|
|
324
|
+
export { Radio }
|
|
325
|
+
export { Radio as Radio_alias_1 }
|
|
326
|
+
|
|
327
|
+
declare interface RadioBaseProps extends Omit<InputHTMLAttributes<HTMLInputElement>, 'size'> {
|
|
328
|
+
id: string;
|
|
329
|
+
}
|
|
330
|
+
export { RadioBaseProps }
|
|
331
|
+
export { RadioBaseProps as RadioBaseProps_alias_1 }
|
|
332
|
+
|
|
333
|
+
declare type RadioProps = RadioBaseProps & RadioRecipe;
|
|
334
|
+
export { RadioProps }
|
|
335
|
+
export { RadioProps as RadioProps_alias_1 }
|
|
336
|
+
|
|
337
|
+
declare type RadioRecipe = RecipeVariantProps_2<typeof radio>;
|
|
338
|
+
export { RadioRecipe }
|
|
339
|
+
export { RadioRecipe as RadioRecipe_alias_1 }
|
|
340
|
+
|
|
282
341
|
/**
|
|
283
342
|
* Conditionally render its children or an optional fallback component
|
|
284
343
|
* based on the SolidJS component.
|
|
@@ -300,6 +359,12 @@ declare interface ShowProps {
|
|
|
300
359
|
export { ShowProps }
|
|
301
360
|
export { ShowProps as ShowProps_alias_1 }
|
|
302
361
|
|
|
362
|
+
declare type StaticTagProps = HTMLAttributes<HTMLSpanElement> & TagRecipeProps & {
|
|
363
|
+
onClick?: never;
|
|
364
|
+
};
|
|
365
|
+
export { StaticTagProps }
|
|
366
|
+
export { StaticTagProps as StaticTagProps_alias_1 }
|
|
367
|
+
|
|
303
368
|
/**
|
|
304
369
|
* The Tab component provides a tab element to be used in a TabList.
|
|
305
370
|
* @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)
|
|
@@ -424,23 +489,28 @@ export { TabsProps as TabsProps_alias_1 }
|
|
|
424
489
|
|
|
425
490
|
/**
|
|
426
491
|
* The Tag component is used to display a meta descriptions.
|
|
492
|
+
* @definition [Tag docs](https://cerberus.digitalu.design/react/tags)
|
|
427
493
|
* @example
|
|
428
494
|
* ```tsx
|
|
429
495
|
* <Tag>Tag</Tag>
|
|
430
496
|
* ```
|
|
431
497
|
*/
|
|
432
|
-
declare function Tag(props: PropsWithChildren<TagProps
|
|
498
|
+
declare function Tag(props: PropsWithChildren<TagProps>): JSX.Element;
|
|
433
499
|
export { Tag }
|
|
434
500
|
export { Tag as Tag_alias_1 }
|
|
435
501
|
|
|
436
|
-
declare
|
|
437
|
-
palette?: NonActionablePalette;
|
|
438
|
-
shape?: 'rounded' | 'pill';
|
|
439
|
-
usage?: 'filled' | 'outline';
|
|
440
|
-
}
|
|
502
|
+
declare type TagProps = StaticTagProps | ClickableTagProps;
|
|
441
503
|
export { TagProps }
|
|
442
504
|
export { TagProps as TagProps_alias_1 }
|
|
443
505
|
|
|
506
|
+
/**
|
|
507
|
+
* This module contains the tag component.
|
|
508
|
+
* @module
|
|
509
|
+
*/
|
|
510
|
+
declare type TagRecipeProps = RecipeVariantProps_3<typeof tag>;
|
|
511
|
+
export { TagRecipeProps }
|
|
512
|
+
export { TagRecipeProps as TagRecipeProps_alias_1 }
|
|
513
|
+
|
|
444
514
|
/**
|
|
445
515
|
* A component that allows the user to input large blocks of text.
|
|
446
516
|
* @description https://github.com/omnifed/cerberus/blob/main/packages/react/src/components/Textarea.tsx
|
|
@@ -453,10 +523,14 @@ export { Textarea as Textarea_alias_1 }
|
|
|
453
523
|
* This module contains the Textarea component.
|
|
454
524
|
* @module
|
|
455
525
|
*/
|
|
456
|
-
declare interface
|
|
526
|
+
declare interface TextareaBaseProps extends Omit<TextareaHTMLAttributes<HTMLTextAreaElement>, 'id'> {
|
|
457
527
|
describedBy?: string;
|
|
458
528
|
id: string;
|
|
459
529
|
}
|
|
530
|
+
export { TextareaBaseProps }
|
|
531
|
+
export { TextareaBaseProps as TextareaBaseProps_alias_1 }
|
|
532
|
+
|
|
533
|
+
declare type TextareaProps = InputRecipeProps & TextareaBaseProps;
|
|
460
534
|
export { TextareaProps }
|
|
461
535
|
export { TextareaProps as TextareaProps_alias_1 }
|
|
462
536
|
|
|
@@ -486,6 +560,29 @@ declare function ThemeProvider(props: PropsWithChildren<unknown>): JSX.Element;
|
|
|
486
560
|
export { ThemeProvider }
|
|
487
561
|
export { ThemeProvider as ThemeProvider_alias_1 }
|
|
488
562
|
|
|
563
|
+
declare function Toggle(props: ToggleProps): JSX_2.Element;
|
|
564
|
+
export { Toggle }
|
|
565
|
+
export { Toggle as Toggle_alias_1 }
|
|
566
|
+
|
|
567
|
+
declare type ToggleBase = Omit<InputHTMLAttributes<HTMLInputElement>, 'size' | 'id' | 'value'> & {
|
|
568
|
+
describedBy?: string;
|
|
569
|
+
id: string;
|
|
570
|
+
value: string;
|
|
571
|
+
};
|
|
572
|
+
export { ToggleBase }
|
|
573
|
+
export { ToggleBase as ToggleBase_alias_1 }
|
|
574
|
+
|
|
575
|
+
declare interface ToggleHookReturn {
|
|
576
|
+
checked: string;
|
|
577
|
+
handleChange: (e: ChangeEvent<HTMLInputElement>) => void;
|
|
578
|
+
}
|
|
579
|
+
export { ToggleHookReturn }
|
|
580
|
+
export { ToggleHookReturn as ToggleHookReturn_alias_1 }
|
|
581
|
+
|
|
582
|
+
declare type ToggleProps = ToggleBase & ToggleVariantProps;
|
|
583
|
+
export { ToggleProps }
|
|
584
|
+
export { ToggleProps as ToggleProps_alias_1 }
|
|
585
|
+
|
|
489
586
|
declare function useFieldContext(): FieldContextValue;
|
|
490
587
|
export { useFieldContext }
|
|
491
588
|
export { useFieldContext as useFieldContext_alias_1 }
|
|
@@ -512,4 +609,15 @@ declare function useThemeContext(): ThemeContextValue<DefaultThemes>;
|
|
|
512
609
|
export { useThemeContext }
|
|
513
610
|
export { useThemeContext as useThemeContext_alias_1 }
|
|
514
611
|
|
|
612
|
+
declare function useToggle(options?: UseToggleOptions): ToggleHookReturn;
|
|
613
|
+
export { useToggle }
|
|
614
|
+
export { useToggle as useToggle_alias_1 }
|
|
615
|
+
|
|
616
|
+
declare interface UseToggleOptions {
|
|
617
|
+
checked?: string;
|
|
618
|
+
onChange?: (e: ChangeEvent<HTMLInputElement>) => void;
|
|
619
|
+
}
|
|
620
|
+
export { UseToggleOptions }
|
|
621
|
+
export { UseToggleOptions as UseToggleOptions_alias_1 }
|
|
622
|
+
|
|
515
623
|
export { }
|
|
@@ -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,24 @@
|
|
|
1
|
+
import {
|
|
2
|
+
defaultIcons
|
|
3
|
+
} from "./chunk-5MNCW677.js";
|
|
4
|
+
|
|
5
|
+
// src/config/defineIcons.ts
|
|
6
|
+
function _validateIconsProperties(icons) {
|
|
7
|
+
if (!icons.invalid) {
|
|
8
|
+
throw new Error(
|
|
9
|
+
"The an invalid property must be defined in your custom icons library."
|
|
10
|
+
);
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
function defineIcons(icons) {
|
|
14
|
+
_validateIconsProperties(icons);
|
|
15
|
+
$cerberusIcons = icons;
|
|
16
|
+
return $cerberusIcons;
|
|
17
|
+
}
|
|
18
|
+
var $cerberusIcons = defaultIcons;
|
|
19
|
+
|
|
20
|
+
export {
|
|
21
|
+
defineIcons,
|
|
22
|
+
$cerberusIcons
|
|
23
|
+
};
|
|
24
|
+
//# sourceMappingURL=chunk-3CBN7U25.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/config/defineIcons.ts"],"sourcesContent":["import { defaultIcons, type DefinedIcons } from './cerbIcons'\n\nfunction _validateIconsProperties(icons: DefinedIcons) {\n if (!icons.invalid) {\n throw new Error(\n 'The an invalid property must be defined in your custom icons library.',\n )\n }\n}\n\nexport function defineIcons(icons: DefinedIcons): DefinedIcons {\n _validateIconsProperties(icons)\n $cerberusIcons = icons\n return $cerberusIcons\n}\n\n// Default icons\n\nexport let $cerberusIcons: DefinedIcons = defaultIcons\n"],"mappings":";;;;;AAEA,SAAS,yBAAyB,OAAqB;AACrD,MAAI,CAAC,MAAM,SAAS;AAClB,UAAM,IAAI;AAAA,MACR;AAAA,IACF;AAAA,EACF;AACF;AAEO,SAAS,YAAY,OAAmC;AAC7D,2BAAyB,KAAK;AAC9B,mBAAiB;AACjB,SAAO;AACT;AAIO,IAAI,iBAA+B;","names":[]}
|
|
@@ -4,8 +4,7 @@ function Show(props) {
|
|
|
4
4
|
const { when, children, fallback } = props;
|
|
5
5
|
const condition = useMemo(() => when ?? false, [when]);
|
|
6
6
|
return useMemo(() => {
|
|
7
|
-
if (condition)
|
|
8
|
-
return children;
|
|
7
|
+
if (condition) return children;
|
|
9
8
|
return fallback ?? null;
|
|
10
9
|
}, [condition, children, fallback]);
|
|
11
10
|
}
|
|
@@ -13,4 +12,4 @@ function Show(props) {
|
|
|
13
12
|
export {
|
|
14
13
|
Show
|
|
15
14
|
};
|
|
16
|
-
//# sourceMappingURL=chunk-
|
|
15
|
+
//# sourceMappingURL=chunk-4O4QFF4S.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/components/Show.tsx"],"sourcesContent":["'use client'\n\nimport { useMemo, type PropsWithChildren, type ReactNode } from 'react'\n\nexport interface ShowProps {\n when: boolean | null | undefined\n fallback?: ReactNode\n}\n\n/**\n * Conditionally render its children or an optional fallback component\n * based on the SolidJS component.\n * @definition [Show docs](https://cerberus.digitalu.design/react/show)\n * @example\n * ```tsx\n * <Show when={condition}>\n * <div>Content</div>\n * </Show>\n */\nexport function Show(props: PropsWithChildren<ShowProps>): ReactNode {\n const { when, children, fallback } = props\n const condition = useMemo(() => when ?? false, [when])\n\n return useMemo(() => {\n if (condition) return children\n return fallback ?? null\n }, [condition, children, fallback])\n}\n"],"mappings":";AAEA,SAAS,eAAuD;AAiBzD,SAAS,KAAK,OAAgD;AACnE,QAAM,EAAE,MAAM,UAAU,SAAS,IAAI;AACrC,QAAM,YAAY,QAAQ,MAAM,QAAQ,OAAO,CAAC,IAAI,CAAC;AAErD,SAAO,QAAQ,MAAM;AACnB,QAAI
|
|
1
|
+
{"version":3,"sources":["../../src/components/Show.tsx"],"sourcesContent":["'use client'\n\nimport { useMemo, type PropsWithChildren, type ReactNode } from 'react'\n\nexport interface ShowProps {\n when: boolean | null | undefined\n fallback?: ReactNode\n}\n\n/**\n * Conditionally render its children or an optional fallback component\n * based on the SolidJS component.\n * @definition [Show docs](https://cerberus.digitalu.design/react/show)\n * @example\n * ```tsx\n * <Show when={condition}>\n * <div>Content</div>\n * </Show>\n */\nexport function Show(props: PropsWithChildren<ShowProps>): ReactNode {\n const { when, children, fallback } = props\n const condition = useMemo(() => when ?? false, [when])\n\n return useMemo(() => {\n if (condition) return children\n return fallback ?? null\n }, [condition, children, fallback])\n}\n"],"mappings":";AAEA,SAAS,eAAuD;AAiBzD,SAAS,KAAK,OAAgD;AACnE,QAAM,EAAE,MAAM,UAAU,SAAS,IAAI;AACrC,QAAM,YAAY,QAAQ,MAAM,QAAQ,OAAO,CAAC,IAAI,CAAC;AAErD,SAAO,QAAQ,MAAM;AACnB,QAAI,UAAW,QAAO;AACtB,WAAO,YAAY;AAAA,EACrB,GAAG,CAAC,WAAW,UAAU,QAAQ,CAAC;AACpC;","names":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/config/cerbIcons.ts"],"sourcesContent":["import { Checkmark, WarningFilled, type CarbonIconType } from '@cerberus/icons'\nimport type { ElementType } from 'react'\n\nexport interface DefinedIcons {\n invalid: CarbonIconType | ElementType\n toggleChecked: CarbonIconType | ElementType\n}\n\nexport const defaultIcons: DefinedIcons = {\n invalid: WarningFilled,\n toggleChecked: Checkmark,\n}\n"],"mappings":";AAAA,SAAS,WAAW,qBAA0C;AAQvD,IAAM,eAA6B;AAAA,EACxC,SAAS;AAAA,EACT,eAAe;AACjB;","names":[]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
Show
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-4O4QFF4S.js";
|
|
4
4
|
|
|
5
5
|
// src/components/NavMenuLink.tsx
|
|
6
6
|
import { css, cx } from "@cerberus/styled-system/css";
|
|
@@ -45,4 +45,4 @@ function NavMenuLink(props) {
|
|
|
45
45
|
export {
|
|
46
46
|
NavMenuLink
|
|
47
47
|
};
|
|
48
|
-
//# sourceMappingURL=chunk-
|
|
48
|
+
//# sourceMappingURL=chunk-6DIGPXAD.js.map
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import {
|
|
2
|
+
useFieldContext
|
|
3
|
+
} from "./chunk-ZAU4JVLL.js";
|
|
4
|
+
import {
|
|
5
|
+
$cerberusIcons
|
|
6
|
+
} from "./chunk-3CBN7U25.js";
|
|
7
|
+
|
|
8
|
+
// src/components/Toggle.tsx
|
|
9
|
+
import { cx } from "@cerberus-design/styled-system/css";
|
|
10
|
+
import { hstack, vstack } from "@cerberus-design/styled-system/patterns";
|
|
11
|
+
import {
|
|
12
|
+
toggle
|
|
13
|
+
} from "@cerberus-design/styled-system/recipes";
|
|
14
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
15
|
+
function Toggle(props) {
|
|
16
|
+
const { size, describedBy, ...nativeProps } = props;
|
|
17
|
+
const styles = toggle({ size });
|
|
18
|
+
const { invalid, ...state } = useFieldContext();
|
|
19
|
+
const Icon = $cerberusIcons.toggleChecked;
|
|
20
|
+
return /* @__PURE__ */ jsxs(
|
|
21
|
+
"span",
|
|
22
|
+
{
|
|
23
|
+
className: cx("group", styles.track, hstack()),
|
|
24
|
+
"data-checked": props.checked || props.defaultChecked,
|
|
25
|
+
children: [
|
|
26
|
+
/* @__PURE__ */ jsx(
|
|
27
|
+
"input",
|
|
28
|
+
{
|
|
29
|
+
...nativeProps,
|
|
30
|
+
...state,
|
|
31
|
+
...describedBy && { "aria-describedby": describedBy },
|
|
32
|
+
...invalid && { "aria-invalid": true },
|
|
33
|
+
className: cx("peer", styles.input),
|
|
34
|
+
role: "switch",
|
|
35
|
+
type: "checkbox"
|
|
36
|
+
}
|
|
37
|
+
),
|
|
38
|
+
/* @__PURE__ */ jsx(
|
|
39
|
+
"span",
|
|
40
|
+
{
|
|
41
|
+
className: cx(
|
|
42
|
+
styles.thumb,
|
|
43
|
+
vstack({
|
|
44
|
+
justify: "center"
|
|
45
|
+
})
|
|
46
|
+
),
|
|
47
|
+
children: /* @__PURE__ */ jsx(Icon, {})
|
|
48
|
+
}
|
|
49
|
+
)
|
|
50
|
+
]
|
|
51
|
+
}
|
|
52
|
+
);
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
export {
|
|
56
|
+
Toggle
|
|
57
|
+
};
|
|
58
|
+
//# sourceMappingURL=chunk-734PGVLT.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/components/Toggle.tsx"],"sourcesContent":["'use client'\n\nimport { cx } from '@cerberus-design/styled-system/css'\nimport { hstack, vstack } from '@cerberus-design/styled-system/patterns'\nimport {\n toggle,\n type ToggleVariantProps,\n} from '@cerberus-design/styled-system/recipes'\nimport type { InputHTMLAttributes } from 'react'\nimport { $cerberusIcons } from '../config/defineIcons'\nimport { useFieldContext } from '../context/field'\n\nexport type ToggleBase = Omit<\n InputHTMLAttributes<HTMLInputElement>,\n 'size' | 'id' | 'value'\n> & {\n describedBy?: string\n id: string\n value: string\n}\nexport type ToggleProps = ToggleBase & ToggleVariantProps\n\nexport function Toggle(props: ToggleProps) {\n const { size, describedBy, ...nativeProps } = props\n const styles = toggle({ size })\n const { invalid, ...state } = useFieldContext()\n const Icon = $cerberusIcons.toggleChecked\n\n return (\n <span\n className={cx('group', styles.track, hstack())}\n data-checked={props.checked || props.defaultChecked}\n >\n <input\n {...nativeProps}\n {...state}\n {...(describedBy && { 'aria-describedby': describedBy })}\n {...(invalid && { 'aria-invalid': true })}\n className={cx('peer', styles.input)}\n role=\"switch\"\n type=\"checkbox\"\n />\n <span\n className={cx(\n styles.thumb,\n vstack({\n justify: 'center',\n }),\n )}\n >\n <Icon />\n </span>\n </span>\n )\n}\n"],"mappings":";;;;;;;;AAEA,SAAS,UAAU;AACnB,SAAS,QAAQ,cAAc;AAC/B;AAAA,EACE;AAAA,OAEK;AAsBH,SAIE,KAJF;AAPG,SAAS,OAAO,OAAoB;AACzC,QAAM,EAAE,MAAM,aAAa,GAAG,YAAY,IAAI;AAC9C,QAAM,SAAS,OAAO,EAAE,KAAK,CAAC;AAC9B,QAAM,EAAE,SAAS,GAAG,MAAM,IAAI,gBAAgB;AAC9C,QAAM,OAAO,eAAe;AAE5B,SACE;AAAA,IAAC;AAAA;AAAA,MACC,WAAW,GAAG,SAAS,OAAO,OAAO,OAAO,CAAC;AAAA,MAC7C,gBAAc,MAAM,WAAW,MAAM;AAAA,MAErC;AAAA;AAAA,UAAC;AAAA;AAAA,YACE,GAAG;AAAA,YACH,GAAG;AAAA,YACH,GAAI,eAAe,EAAE,oBAAoB,YAAY;AAAA,YACrD,GAAI,WAAW,EAAE,gBAAgB,KAAK;AAAA,YACvC,WAAW,GAAG,QAAQ,OAAO,KAAK;AAAA,YAClC,MAAK;AAAA,YACL,MAAK;AAAA;AAAA,QACP;AAAA,QACA;AAAA,UAAC;AAAA;AAAA,YACC,WAAW;AAAA,cACT,OAAO;AAAA,cACP,OAAO;AAAA,gBACL,SAAS;AAAA,cACX,CAAC;AAAA,YACH;AAAA,YAEA,8BAAC,QAAK;AAAA;AAAA,QACR;AAAA;AAAA;AAAA,EACF;AAEJ;","names":[]}
|
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
} from "./chunk-KJUCHZHV.js";
|
|
4
4
|
import {
|
|
5
5
|
Show
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-4O4QFF4S.js";
|
|
7
7
|
|
|
8
8
|
// src/components/NavMenuList.tsx
|
|
9
9
|
import { useMemo } from "react";
|
|
@@ -83,4 +83,4 @@ export {
|
|
|
83
83
|
getPosition,
|
|
84
84
|
NavMenuList
|
|
85
85
|
};
|
|
86
|
-
//# sourceMappingURL=chunk-
|
|
86
|
+
//# sourceMappingURL=chunk-G2QMBSK5.js.map
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
Show
|
|
3
|
-
} from "./chunk-R4H3352X.js";
|
|
4
1
|
import {
|
|
5
2
|
useFieldContext
|
|
6
3
|
} from "./chunk-ZAU4JVLL.js";
|
|
4
|
+
import {
|
|
5
|
+
Show
|
|
6
|
+
} from "./chunk-4O4QFF4S.js";
|
|
7
7
|
|
|
8
8
|
// src/components/Label.tsx
|
|
9
9
|
import { label } from "@cerberus/styled-system/recipes";
|
|
@@ -11,16 +11,17 @@ import { css, cx } from "@cerberus/styled-system/css";
|
|
|
11
11
|
import { hstack } from "@cerberus/styled-system/patterns";
|
|
12
12
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
13
13
|
function Label(props) {
|
|
14
|
-
const { hidden, ...nativeProps } = props;
|
|
15
|
-
const { required } = useFieldContext();
|
|
14
|
+
const { hidden, size, ...nativeProps } = props;
|
|
15
|
+
const { required, disabled } = useFieldContext();
|
|
16
16
|
const usage = hidden ? "hidden" : "visible";
|
|
17
17
|
return /* @__PURE__ */ jsxs(
|
|
18
18
|
"label",
|
|
19
19
|
{
|
|
20
20
|
...nativeProps,
|
|
21
|
+
"data-disabled": disabled,
|
|
21
22
|
className: cx(
|
|
22
23
|
nativeProps.className,
|
|
23
|
-
label({ usage }),
|
|
24
|
+
label({ size, usage }),
|
|
24
25
|
hstack({
|
|
25
26
|
justify: "space-between"
|
|
26
27
|
})
|
|
@@ -45,4 +46,4 @@ function Label(props) {
|
|
|
45
46
|
export {
|
|
46
47
|
Label
|
|
47
48
|
};
|
|
48
|
-
//# sourceMappingURL=chunk-
|
|
49
|
+
//# sourceMappingURL=chunk-HE3HFKYU.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/components/Label.tsx"],"sourcesContent":["'use client'\n\nimport type { HTMLAttributes, PropsWithChildren } from 'react'\nimport { label } from '@cerberus/styled-system/recipes'\nimport { css, cx, type RecipeVariantProps } from '@cerberus/styled-system/css'\nimport { hstack } from '@cerberus/styled-system/patterns'\nimport { useFieldContext } from '../context/field'\nimport { Show } from './Show'\n\n/**\n * This module contains the Label component.\n * @module\n */\n\nexport type LabelRecipeProps = RecipeVariantProps<typeof label>\nexport interface LabelBaseProps extends HTMLAttributes<HTMLLabelElement> {\n htmlFor: string\n hidden?: boolean\n}\nexport type LabelProps = LabelBaseProps & LabelRecipeProps\n\n/**\n * A screen ready friendly label component.\n * @definition [ARIA Forms](https://www.a11yproject.com/checklist/#forms)\n * @definition [Label docs](https://cerberus.digitalu.design/react/label)\n * @example\n * ```tsx\n * <Field required>\n * <Label htmlFor=\"test\">Test Label</Label>\n * </Field>\n * ```\n */\nexport function Label(props: PropsWithChildren<LabelProps>) {\n const { hidden, size, ...nativeProps } = props\n const { required, disabled } = useFieldContext()\n const usage = hidden ? 'hidden' : 'visible'\n\n return (\n <label\n {...nativeProps}\n data-disabled={disabled}\n className={cx(\n nativeProps.className,\n label({ size, usage }),\n hstack({\n justify: 'space-between',\n }),\n )}\n >\n {props.children}\n <Show when={required}>\n <span\n className={css({\n color: 'neutral.text.100',\n fontSize: 'inherit',\n })}\n >\n (required)\n </span>\n </Show>\n </label>\n )\n}\n"],"mappings":";;;;;;;;AAGA,SAAS,aAAa;AACtB,SAAS,KAAK,UAAmC;AACjD,SAAS,cAAc;AAiCnB,SAaI,KAbJ;AANG,SAAS,MAAM,OAAsC;AAC1D,QAAM,EAAE,QAAQ,MAAM,GAAG,YAAY,IAAI;AACzC,QAAM,EAAE,UAAU,SAAS,IAAI,gBAAgB;AAC/C,QAAM,QAAQ,SAAS,WAAW;AAElC,SACE;AAAA,IAAC;AAAA;AAAA,MACE,GAAG;AAAA,MACJ,iBAAe;AAAA,MACf,WAAW;AAAA,QACT,YAAY;AAAA,QACZ,MAAM,EAAE,MAAM,MAAM,CAAC;AAAA,QACrB,OAAO;AAAA,UACL,SAAS;AAAA,QACX,CAAC;AAAA,MACH;AAAA,MAEC;AAAA,cAAM;AAAA,QACP,oBAAC,QAAK,MAAM,UACV;AAAA,UAAC;AAAA;AAAA,YACC,WAAW,IAAI;AAAA,cACb,OAAO;AAAA,cACP,UAAU;AAAA,YACZ,CAAC;AAAA,YACF;AAAA;AAAA,QAED,GACF;AAAA;AAAA;AAAA,EACF;AAEJ;","names":[]}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
// src/hooks/useToggle.ts
|
|
2
|
+
import { useCallback, useMemo, useState } from "react";
|
|
3
|
+
function useToggle(options) {
|
|
4
|
+
const [checked, setChecked] = useState(options?.checked ?? "");
|
|
5
|
+
const onChange = options?.onChange;
|
|
6
|
+
const handleChange = useCallback(
|
|
7
|
+
(e) => {
|
|
8
|
+
const target = e.currentTarget;
|
|
9
|
+
setChecked((prev) => {
|
|
10
|
+
return prev === target.value ? "" : target.value;
|
|
11
|
+
});
|
|
12
|
+
onChange?.(e);
|
|
13
|
+
},
|
|
14
|
+
[onChange]
|
|
15
|
+
);
|
|
16
|
+
return useMemo(() => ({ checked, handleChange }), [checked, handleChange]);
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export {
|
|
20
|
+
useToggle
|
|
21
|
+
};
|
|
22
|
+
//# sourceMappingURL=chunk-QEA6N6TN.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/hooks/useToggle.ts"],"sourcesContent":["'use client'\n\nimport { useCallback, useMemo, useState, type ChangeEvent } from 'react'\n\nexport interface UseToggleOptions {\n checked?: string\n onChange?: (e: ChangeEvent<HTMLInputElement>) => void\n}\nexport interface ToggleHookReturn {\n checked: string\n handleChange: (e: ChangeEvent<HTMLInputElement>) => void\n}\n\nexport function useToggle(options?: UseToggleOptions): ToggleHookReturn {\n const [checked, setChecked] = useState<string>(options?.checked ?? '')\n const onChange = options?.onChange\n\n const handleChange = useCallback(\n (e: ChangeEvent<HTMLInputElement>) => {\n const target = e.currentTarget as HTMLInputElement\n setChecked((prev) => {\n return prev === target.value ? '' : target.value\n })\n onChange?.(e)\n },\n [onChange],\n )\n\n return useMemo(() => ({ checked, handleChange }), [checked, handleChange])\n}\n"],"mappings":";AAEA,SAAS,aAAa,SAAS,gBAAkC;AAW1D,SAAS,UAAU,SAA8C;AACtE,QAAM,CAAC,SAAS,UAAU,IAAI,SAAiB,SAAS,WAAW,EAAE;AACrE,QAAM,WAAW,SAAS;AAE1B,QAAM,eAAe;AAAA,IACnB,CAAC,MAAqC;AACpC,YAAM,SAAS,EAAE;AACjB,iBAAW,CAAC,SAAS;AACnB,eAAO,SAAS,OAAO,QAAQ,KAAK,OAAO;AAAA,MAC7C,CAAC;AACD,iBAAW,CAAC;AAAA,IACd;AAAA,IACA,CAAC,QAAQ;AAAA,EACX;AAEA,SAAO,QAAQ,OAAO,EAAE,SAAS,aAAa,IAAI,CAAC,SAAS,YAAY,CAAC;AAC3E;","names":[]}
|
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
} from "./chunk-KJUCHZHV.js";
|
|
4
4
|
import {
|
|
5
5
|
Show
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-4O4QFF4S.js";
|
|
7
7
|
import {
|
|
8
8
|
createNavTriggerProps
|
|
9
9
|
} from "./chunk-JF76VIL3.js";
|
|
@@ -35,8 +35,7 @@ function NavMenuTrigger(props) {
|
|
|
35
35
|
const AsSub = as;
|
|
36
36
|
const handleClick = useCallback(
|
|
37
37
|
(e) => {
|
|
38
|
-
if (onClick)
|
|
39
|
-
return onClick(e);
|
|
38
|
+
if (onClick) return onClick(e);
|
|
40
39
|
onToggle();
|
|
41
40
|
},
|
|
42
41
|
[onClick, onToggle]
|
|
@@ -79,4 +78,4 @@ function NavMenuTrigger(props) {
|
|
|
79
78
|
export {
|
|
80
79
|
NavMenuTrigger
|
|
81
80
|
};
|
|
82
|
-
//# sourceMappingURL=chunk-
|
|
81
|
+
//# sourceMappingURL=chunk-RPZAPUCF.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/components/NavMenuTrigger.tsx"],"sourcesContent":["'use client'\n\nimport {\n useCallback,\n type ButtonHTMLAttributes,\n type ElementType,\n type MouseEvent,\n} from 'react'\nimport { cx } from '@cerberus/styled-system/css'\nimport { button } from '@cerberus/styled-system/recipes'\nimport {\n createNavTriggerProps,\n type NavTriggerAriaValues,\n} from '../aria-helpers/nav-menu.aria'\nimport { useNavMenuContext } from '../context/navMenu'\nimport type { ButtonProps } from './Button'\nimport { Show } from './Show'\n\nexport interface NavMenuTriggerProps\n extends ButtonHTMLAttributes<HTMLButtonElement>,\n ButtonProps,\n NavTriggerAriaValues {\n as?: ElementType\n}\n\n/**\n * A component that allows the user to trigger a navigation menu.\n * @definition [NavMenu Docs](https://cerberus.digitalu.design/react/nav-menu)\n * @example\n * ```tsx\n * <NavMenu>\n * <NavMenuTrigger controls=\"nav-menu-list\">\n * Menu\n * </NavMenuTrigger>\n * </NavMenu>\n * ```\n */\nexport function NavMenuTrigger(props: NavMenuTriggerProps): JSX.Element {\n const {\n as,\n palette,\n usage,\n shape,\n controls,\n expanded: propsExpanded,\n onClick,\n ...nativeProps\n } = props\n const { triggerRef, onToggle, expanded } = useNavMenuContext()\n const ariaProps = createNavTriggerProps({\n controls,\n expanded: propsExpanded ?? expanded,\n })\n const hasAs = Boolean(as)\n const AsSub: ElementType = as!\n\n const handleClick = useCallback(\n (e: MouseEvent<HTMLButtonElement>) => {\n if (onClick) return onClick(e)\n onToggle()\n },\n [onClick, onToggle],\n )\n\n return (\n <Show\n when={hasAs}\n fallback={\n <button\n {...nativeProps}\n {...ariaProps}\n className={cx(\n nativeProps.className,\n button({\n palette,\n usage,\n shape,\n }),\n )}\n onClick={handleClick}\n ref={triggerRef}\n >\n {props.children}\n </button>\n }\n >\n {hasAs && (\n <AsSub\n {...nativeProps}\n {...ariaProps}\n onClick={handleClick}\n ref={triggerRef}\n />\n )}\n </Show>\n )\n}\n"],"mappings":";;;;;;;;;;;AAEA;AAAA,EACE;AAAA,OAIK;AACP,SAAS,UAAU;AACnB,SAAS,cAAc;AA2Df;AA/BD,SAAS,eAAe,OAAyC;AACtE,QAAM;AAAA,IACJ;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,UAAU;AAAA,IACV;AAAA,IACA,GAAG;AAAA,EACL,IAAI;AACJ,QAAM,EAAE,YAAY,UAAU,SAAS,IAAI,kBAAkB;AAC7D,QAAM,YAAY,sBAAsB;AAAA,IACtC;AAAA,IACA,UAAU,iBAAiB;AAAA,EAC7B,CAAC;AACD,QAAM,QAAQ,QAAQ,EAAE;AACxB,QAAM,QAAqB;AAE3B,QAAM,cAAc;AAAA,IAClB,CAAC,MAAqC;AACpC,UAAI
|
|
1
|
+
{"version":3,"sources":["../../src/components/NavMenuTrigger.tsx"],"sourcesContent":["'use client'\n\nimport {\n useCallback,\n type ButtonHTMLAttributes,\n type ElementType,\n type MouseEvent,\n} from 'react'\nimport { cx } from '@cerberus/styled-system/css'\nimport { button } from '@cerberus/styled-system/recipes'\nimport {\n createNavTriggerProps,\n type NavTriggerAriaValues,\n} from '../aria-helpers/nav-menu.aria'\nimport { useNavMenuContext } from '../context/navMenu'\nimport type { ButtonProps } from './Button'\nimport { Show } from './Show'\n\nexport interface NavMenuTriggerProps\n extends ButtonHTMLAttributes<HTMLButtonElement>,\n ButtonProps,\n NavTriggerAriaValues {\n as?: ElementType\n}\n\n/**\n * A component that allows the user to trigger a navigation menu.\n * @definition [NavMenu Docs](https://cerberus.digitalu.design/react/nav-menu)\n * @example\n * ```tsx\n * <NavMenu>\n * <NavMenuTrigger controls=\"nav-menu-list\">\n * Menu\n * </NavMenuTrigger>\n * </NavMenu>\n * ```\n */\nexport function NavMenuTrigger(props: NavMenuTriggerProps): JSX.Element {\n const {\n as,\n palette,\n usage,\n shape,\n controls,\n expanded: propsExpanded,\n onClick,\n ...nativeProps\n } = props\n const { triggerRef, onToggle, expanded } = useNavMenuContext()\n const ariaProps = createNavTriggerProps({\n controls,\n expanded: propsExpanded ?? expanded,\n })\n const hasAs = Boolean(as)\n const AsSub: ElementType = as!\n\n const handleClick = useCallback(\n (e: MouseEvent<HTMLButtonElement>) => {\n if (onClick) return onClick(e)\n onToggle()\n },\n [onClick, onToggle],\n )\n\n return (\n <Show\n when={hasAs}\n fallback={\n <button\n {...nativeProps}\n {...ariaProps}\n className={cx(\n nativeProps.className,\n button({\n palette,\n usage,\n shape,\n }),\n )}\n onClick={handleClick}\n ref={triggerRef}\n >\n {props.children}\n </button>\n }\n >\n {hasAs && (\n <AsSub\n {...nativeProps}\n {...ariaProps}\n onClick={handleClick}\n ref={triggerRef}\n />\n )}\n </Show>\n )\n}\n"],"mappings":";;;;;;;;;;;AAEA;AAAA,EACE;AAAA,OAIK;AACP,SAAS,UAAU;AACnB,SAAS,cAAc;AA2Df;AA/BD,SAAS,eAAe,OAAyC;AACtE,QAAM;AAAA,IACJ;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,UAAU;AAAA,IACV;AAAA,IACA,GAAG;AAAA,EACL,IAAI;AACJ,QAAM,EAAE,YAAY,UAAU,SAAS,IAAI,kBAAkB;AAC7D,QAAM,YAAY,sBAAsB;AAAA,IACtC;AAAA,IACA,UAAU,iBAAiB;AAAA,EAC7B,CAAC;AACD,QAAM,QAAQ,QAAQ,EAAE;AACxB,QAAM,QAAqB;AAE3B,QAAM,cAAc;AAAA,IAClB,CAAC,MAAqC;AACpC,UAAI,QAAS,QAAO,QAAQ,CAAC;AAC7B,eAAS;AAAA,IACX;AAAA,IACA,CAAC,SAAS,QAAQ;AAAA,EACpB;AAEA,SACE;AAAA,IAAC;AAAA;AAAA,MACC,MAAM;AAAA,MACN,UACE;AAAA,QAAC;AAAA;AAAA,UACE,GAAG;AAAA,UACH,GAAG;AAAA,UACJ,WAAW;AAAA,YACT,YAAY;AAAA,YACZ,OAAO;AAAA,cACL;AAAA,cACA;AAAA,cACA;AAAA,YACF,CAAC;AAAA,UACH;AAAA,UACA,SAAS;AAAA,UACT,KAAK;AAAA,UAEJ,gBAAM;AAAA;AAAA,MACT;AAAA,MAGD,mBACC;AAAA,QAAC;AAAA;AAAA,UACE,GAAG;AAAA,UACH,GAAG;AAAA,UACJ,SAAS;AAAA,UACT,KAAK;AAAA;AAAA,MACP;AAAA;AAAA,EAEJ;AAEJ;","names":[]}
|