@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
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cerberus-design/react",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.6.0",
|
|
4
4
|
"description": "The Cerberus Design React component library.",
|
|
5
5
|
"browserslist": "> 0.25%, not dead",
|
|
6
6
|
"sideEffects": false,
|
|
@@ -8,9 +8,9 @@
|
|
|
8
8
|
"main": "build/legacy/index.cjs",
|
|
9
9
|
"module": "build/legacy/index.js",
|
|
10
10
|
"peerDependencies": {
|
|
11
|
-
"@cerberus/panda-preset": "npm:@jsr/cerberus__panda-preset",
|
|
12
|
-
"@cerberus/styled-system": "npm:@cerberus-design/styled-system@next",
|
|
13
11
|
"@cerberus/icons": "npm:@jsr/cerberus__icons",
|
|
12
|
+
"@cerberus/panda-preset": "npm:@jsr/cerberus__panda-preset",
|
|
13
|
+
"@cerberus/styled-system": "npm:@cerberus-design/styled-system@workspace:*",
|
|
14
14
|
"@pandacss/dev": "*",
|
|
15
15
|
"react": "*",
|
|
16
16
|
"react-dom": "*"
|
|
@@ -20,8 +20,9 @@
|
|
|
20
20
|
"@types/react": "^18",
|
|
21
21
|
"react": "^18",
|
|
22
22
|
"react-dom": "^18",
|
|
23
|
-
"tsup": "^8.0
|
|
24
|
-
"@cerberus-design/configs": "0.0.0"
|
|
23
|
+
"tsup": "^8.1.0",
|
|
24
|
+
"@cerberus-design/configs": "0.0.0",
|
|
25
|
+
"@cerberus-design/styled-system": "0.6.0"
|
|
25
26
|
},
|
|
26
27
|
"publishConfig": {
|
|
27
28
|
"access": "public"
|
|
@@ -46,7 +47,7 @@
|
|
|
46
47
|
"author": "developers@omnifederal.com",
|
|
47
48
|
"license": "ISC",
|
|
48
49
|
"scripts": {
|
|
49
|
-
"build": "tsup
|
|
50
|
+
"build": "tsup --experimental-dts noExternals",
|
|
50
51
|
"clean": "rm -rf ./build",
|
|
51
52
|
"lint:ts": "tsc --project tsconfig.lint.json --noEmit"
|
|
52
53
|
},
|
|
@@ -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' | 'outline' | '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,23 +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
|
|
12
|
-
export interface IconButtonProps
|
|
11
|
+
export interface IconButtonRawProps
|
|
13
12
|
extends ButtonHTMLAttributes<HTMLButtonElement> {
|
|
14
13
|
ariaLabel: string
|
|
15
|
-
|
|
16
|
-
usage?: IconButtonUsage
|
|
17
|
-
shape?: 'circle'
|
|
18
|
-
size?: 'sm' | 'lg'
|
|
19
|
-
tooltipPosition?: 'top' | 'bottom' | 'left' | 'right'
|
|
14
|
+
tooltipPosition?: Positions
|
|
20
15
|
}
|
|
16
|
+
export type IconButtonRecipeProps = RecipeVariantProps<typeof iconButton>
|
|
17
|
+
export type IconButtonProps = IconButtonRawProps & IconButtonRecipeProps
|
|
21
18
|
|
|
22
19
|
/**
|
|
23
20
|
* A component that allows the user to perform actions using an icon
|
package/src/components/Input.tsx
CHANGED
|
@@ -1,35 +1,49 @@
|
|
|
1
1
|
'use client'
|
|
2
2
|
|
|
3
|
-
import type { InputHTMLAttributes } from 'react'
|
|
4
|
-
import { WarningFilled } from '@cerberus/icons'
|
|
3
|
+
import type { InputHTMLAttributes, ReactNode } from 'react'
|
|
5
4
|
import { input } from '@cerberus/styled-system/recipes'
|
|
6
|
-
import { cx } from '@cerberus/styled-system/css'
|
|
5
|
+
import { cx, type RecipeVariantProps } from '@cerberus/styled-system/css'
|
|
7
6
|
import { useFieldContext } from '../context/field'
|
|
7
|
+
import { $cerberusIcons } from '../config/defineIcons'
|
|
8
8
|
import { Show } from './Show'
|
|
9
9
|
|
|
10
|
-
export
|
|
10
|
+
export type InputRecipeProps = RecipeVariantProps<typeof input>
|
|
11
|
+
export interface InputBaseProps
|
|
11
12
|
extends Omit<InputHTMLAttributes<HTMLInputElement>, 'id' | 'size'> {
|
|
12
13
|
describedBy?: string
|
|
13
14
|
id: string
|
|
14
|
-
|
|
15
|
+
startIcon?: ReactNode
|
|
16
|
+
endIcon?: ReactNode
|
|
15
17
|
}
|
|
18
|
+
export type InputProps = InputBaseProps & InputRecipeProps
|
|
16
19
|
|
|
17
20
|
export function Input(props: InputProps) {
|
|
18
|
-
const { describedBy, size, ...nativeProps } = props
|
|
21
|
+
const { describedBy, size, startIcon, endIcon, ...nativeProps } = props
|
|
19
22
|
const inputStyles = input({ size })
|
|
20
23
|
const { invalid, ...fieldStates } = useFieldContext()
|
|
24
|
+
const hasEndIcon = Boolean(endIcon)
|
|
25
|
+
const { invalid: InvalidIcon } = $cerberusIcons
|
|
21
26
|
|
|
22
27
|
return (
|
|
23
28
|
<div className={inputStyles.root}>
|
|
29
|
+
<Show when={Boolean(startIcon)}>
|
|
30
|
+
<span className={inputStyles.startIcon}>{startIcon}</span>
|
|
31
|
+
</Show>
|
|
32
|
+
|
|
24
33
|
<input
|
|
25
34
|
{...nativeProps}
|
|
26
35
|
{...fieldStates}
|
|
27
36
|
{...(describedBy && { 'aria-describedby': describedBy })}
|
|
28
37
|
{...(invalid && { 'aria-invalid': true })}
|
|
38
|
+
data-start-icon={Boolean(startIcon)}
|
|
29
39
|
className={cx('peer', nativeProps.className, inputStyles.input)}
|
|
30
40
|
/>
|
|
41
|
+
|
|
31
42
|
<Show when={invalid}>
|
|
32
|
-
<
|
|
43
|
+
<InvalidIcon className={inputStyles.icon} />
|
|
44
|
+
</Show>
|
|
45
|
+
<Show when={hasEndIcon && !invalid}>
|
|
46
|
+
<span className={inputStyles.icon}>{endIcon}</span>
|
|
33
47
|
</Show>
|
|
34
48
|
</div>
|
|
35
49
|
)
|
package/src/components/Label.tsx
CHANGED
|
@@ -2,20 +2,22 @@
|
|
|
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
|
+
import { hstack } from '@cerberus/styled-system/patterns'
|
|
6
7
|
import { useFieldContext } from '../context/field'
|
|
7
8
|
import { Show } from './Show'
|
|
8
|
-
import { hstack } from '@cerberus/styled-system/patterns'
|
|
9
9
|
|
|
10
10
|
/**
|
|
11
11
|
* This module contains the Label component.
|
|
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.
|
|
@@ -29,16 +31,17 @@ export interface LabelProps extends HTMLAttributes<HTMLLabelElement> {
|
|
|
29
31
|
* ```
|
|
30
32
|
*/
|
|
31
33
|
export function Label(props: PropsWithChildren<LabelProps>) {
|
|
32
|
-
const { hidden, ...nativeProps } = props
|
|
33
|
-
const { required } = useFieldContext()
|
|
34
|
+
const { hidden, size, ...nativeProps } = props
|
|
35
|
+
const { required, disabled } = useFieldContext()
|
|
34
36
|
const usage = hidden ? 'hidden' : 'visible'
|
|
35
37
|
|
|
36
38
|
return (
|
|
37
39
|
<label
|
|
38
40
|
{...nativeProps}
|
|
41
|
+
data-disabled={disabled}
|
|
39
42
|
className={cx(
|
|
40
43
|
nativeProps.className,
|
|
41
|
-
label({ usage }),
|
|
44
|
+
label({ size, usage }),
|
|
42
45
|
hstack({
|
|
43
46
|
justify: 'space-between',
|
|
44
47
|
}),
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
'use client'
|
|
2
|
+
|
|
3
|
+
import { cx } from '@cerberus-design/styled-system/css'
|
|
4
|
+
import { hstack } from '@cerberus-design/styled-system/patterns'
|
|
5
|
+
import { radio } from '@cerberus-design/styled-system/recipes'
|
|
6
|
+
import type { RecipeVariantProps } from '@cerberus-design/styled-system/types'
|
|
7
|
+
import type { InputHTMLAttributes, PropsWithChildren } from 'react'
|
|
8
|
+
import { useFieldContext } from '../context/field'
|
|
9
|
+
|
|
10
|
+
export type RadioRecipe = RecipeVariantProps<typeof radio>
|
|
11
|
+
export interface RadioBaseProps
|
|
12
|
+
extends Omit<InputHTMLAttributes<HTMLInputElement>, 'size'> {
|
|
13
|
+
id: string
|
|
14
|
+
}
|
|
15
|
+
export type RadioProps = RadioBaseProps & RadioRecipe
|
|
16
|
+
|
|
17
|
+
export function Radio(props: PropsWithChildren<RadioProps>) {
|
|
18
|
+
const { children, size, ...nativeProps } = props
|
|
19
|
+
const { invalid, ...state } = useFieldContext()
|
|
20
|
+
const styles = radio({ size })
|
|
21
|
+
|
|
22
|
+
return (
|
|
23
|
+
<div className={cx('group', hstack(), styles.root)} tabIndex={0}>
|
|
24
|
+
<input
|
|
25
|
+
{...nativeProps}
|
|
26
|
+
{...state}
|
|
27
|
+
{...(invalid && { 'aria-invalid': true })}
|
|
28
|
+
className={cx(nativeProps.className, styles.input)}
|
|
29
|
+
tabIndex={-1}
|
|
30
|
+
type="radio"
|
|
31
|
+
/>
|
|
32
|
+
{children}
|
|
33
|
+
</div>
|
|
34
|
+
)
|
|
35
|
+
}
|
package/src/components/Tag.tsx
CHANGED
|
@@ -3,48 +3,44 @@ import { Close } from '@cerberus/icons'
|
|
|
3
3
|
import { Show } from './Show'
|
|
4
4
|
import { css, cx } from '@cerberus/styled-system/css'
|
|
5
5
|
import { iconButton, tag } from '@cerberus/styled-system/recipes'
|
|
6
|
-
import type {
|
|
6
|
+
import type { RecipeVariantProps } from '@cerberus/styled-system/types'
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
9
|
* This module contains the tag component.
|
|
10
10
|
* @module
|
|
11
11
|
*/
|
|
12
12
|
|
|
13
|
-
export type
|
|
14
|
-
|
|
15
|
-
>
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
palette?:
|
|
23
|
-
shape?: 'pill'
|
|
13
|
+
export type TagRecipeProps = RecipeVariantProps<typeof tag>
|
|
14
|
+
|
|
15
|
+
export type StaticTagProps = HTMLAttributes<HTMLSpanElement> &
|
|
16
|
+
TagRecipeProps & {
|
|
17
|
+
onClick?: never
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export type ClickableTagProps = HTMLAttributes<HTMLSpanElement> & {
|
|
21
|
+
gradient?: never
|
|
22
|
+
palette?: never
|
|
24
23
|
onClick: () => void
|
|
25
|
-
|
|
24
|
+
shape: 'pill'
|
|
25
|
+
usage: 'filled'
|
|
26
26
|
}
|
|
27
27
|
|
|
28
|
+
export type TagProps = StaticTagProps | ClickableTagProps
|
|
29
|
+
|
|
28
30
|
/**
|
|
29
31
|
* The Tag component is used to display a meta descriptions.
|
|
32
|
+
* @definition [Tag docs](https://cerberus.digitalu.design/react/tags)
|
|
30
33
|
* @example
|
|
31
34
|
* ```tsx
|
|
32
35
|
* <Tag>Tag</Tag>
|
|
33
36
|
* ```
|
|
34
37
|
*/
|
|
35
|
-
export function Tag(
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
const { palette, shape: initShape, onClick, usage, ...nativeProps } = props
|
|
38
|
+
export function Tag(props: PropsWithChildren<TagProps>): JSX.Element {
|
|
39
|
+
const { shape: initShape, gradient, onClick, usage, ...nativeProps } = props
|
|
40
|
+
const palette = props?.palette ?? 'neutral'
|
|
39
41
|
const isClosable = Boolean(onClick)
|
|
40
42
|
const shape = isClosable ? 'pill' : initShape
|
|
41
|
-
const closableStyles = isClosable
|
|
42
|
-
? css({
|
|
43
|
-
bgColor: 'action.bg.active',
|
|
44
|
-
color: 'action.text.initial',
|
|
45
|
-
paddingInlineEnd: '0',
|
|
46
|
-
})
|
|
47
|
-
: ''
|
|
43
|
+
const closableStyles = isClosable ? closableCss : ''
|
|
48
44
|
|
|
49
45
|
return (
|
|
50
46
|
<span
|
|
@@ -52,6 +48,7 @@ export function Tag(
|
|
|
52
48
|
className={cx(
|
|
53
49
|
nativeProps.className,
|
|
54
50
|
tag({
|
|
51
|
+
gradient,
|
|
55
52
|
palette,
|
|
56
53
|
shape,
|
|
57
54
|
usage,
|
|
@@ -77,3 +74,9 @@ export function Tag(
|
|
|
77
74
|
</span>
|
|
78
75
|
)
|
|
79
76
|
}
|
|
77
|
+
|
|
78
|
+
const closableCss = css({
|
|
79
|
+
bgColor: 'action.bg.active',
|
|
80
|
+
color: 'action.text.initial',
|
|
81
|
+
paddingInlineEnd: '0',
|
|
82
|
+
})
|
|
@@ -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.
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
'use client'
|
|
2
|
+
|
|
3
|
+
import { cx } from '@cerberus-design/styled-system/css'
|
|
4
|
+
import { hstack, vstack } from '@cerberus-design/styled-system/patterns'
|
|
5
|
+
import {
|
|
6
|
+
toggle,
|
|
7
|
+
type ToggleVariantProps,
|
|
8
|
+
} from '@cerberus-design/styled-system/recipes'
|
|
9
|
+
import type { InputHTMLAttributes } from 'react'
|
|
10
|
+
import { $cerberusIcons } from '../config/defineIcons'
|
|
11
|
+
import { useFieldContext } from '../context/field'
|
|
12
|
+
|
|
13
|
+
export type ToggleBase = Omit<
|
|
14
|
+
InputHTMLAttributes<HTMLInputElement>,
|
|
15
|
+
'size' | 'id' | 'value'
|
|
16
|
+
> & {
|
|
17
|
+
describedBy?: string
|
|
18
|
+
id: string
|
|
19
|
+
value: string
|
|
20
|
+
}
|
|
21
|
+
export type ToggleProps = ToggleBase & ToggleVariantProps
|
|
22
|
+
|
|
23
|
+
export function Toggle(props: ToggleProps) {
|
|
24
|
+
const { size, describedBy, ...nativeProps } = props
|
|
25
|
+
const styles = toggle({ size })
|
|
26
|
+
const { invalid, ...state } = useFieldContext()
|
|
27
|
+
const Icon = $cerberusIcons.toggleChecked
|
|
28
|
+
|
|
29
|
+
return (
|
|
30
|
+
<span
|
|
31
|
+
className={cx('group', styles.track, hstack())}
|
|
32
|
+
data-checked={props.checked || props.defaultChecked}
|
|
33
|
+
>
|
|
34
|
+
<input
|
|
35
|
+
{...nativeProps}
|
|
36
|
+
{...state}
|
|
37
|
+
{...(describedBy && { 'aria-describedby': describedBy })}
|
|
38
|
+
{...(invalid && { 'aria-invalid': true })}
|
|
39
|
+
className={cx('peer', styles.input)}
|
|
40
|
+
role="switch"
|
|
41
|
+
type="checkbox"
|
|
42
|
+
/>
|
|
43
|
+
<span
|
|
44
|
+
className={cx(
|
|
45
|
+
styles.thumb,
|
|
46
|
+
vstack({
|
|
47
|
+
justify: 'center',
|
|
48
|
+
}),
|
|
49
|
+
)}
|
|
50
|
+
>
|
|
51
|
+
<Icon />
|
|
52
|
+
</span>
|
|
53
|
+
</span>
|
|
54
|
+
)
|
|
55
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { Checkmark, WarningFilled, type CarbonIconType } from '@cerberus/icons'
|
|
2
|
+
import type { ElementType } from 'react'
|
|
3
|
+
|
|
4
|
+
export interface DefinedIcons {
|
|
5
|
+
invalid: CarbonIconType | ElementType
|
|
6
|
+
toggleChecked: CarbonIconType | ElementType
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export const defaultIcons: DefinedIcons = {
|
|
10
|
+
invalid: WarningFilled,
|
|
11
|
+
toggleChecked: Checkmark,
|
|
12
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { defaultIcons, type DefinedIcons } from './cerbIcons'
|
|
2
|
+
|
|
3
|
+
function _validateIconsProperties(icons: DefinedIcons) {
|
|
4
|
+
if (!icons.invalid) {
|
|
5
|
+
throw new Error(
|
|
6
|
+
'The an invalid property must be defined in your custom icons library.',
|
|
7
|
+
)
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export function defineIcons(icons: DefinedIcons): DefinedIcons {
|
|
12
|
+
_validateIconsProperties(icons)
|
|
13
|
+
$cerberusIcons = icons
|
|
14
|
+
return $cerberusIcons
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
// Default icons
|
|
18
|
+
|
|
19
|
+
export let $cerberusIcons: DefinedIcons = defaultIcons
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
'use client'
|
|
2
|
+
|
|
3
|
+
import { useCallback, useMemo, useState, type ChangeEvent } from 'react'
|
|
4
|
+
|
|
5
|
+
export interface UseToggleOptions {
|
|
6
|
+
checked?: string
|
|
7
|
+
onChange?: (e: ChangeEvent<HTMLInputElement>) => void
|
|
8
|
+
}
|
|
9
|
+
export interface ToggleHookReturn {
|
|
10
|
+
checked: string
|
|
11
|
+
handleChange: (e: ChangeEvent<HTMLInputElement>) => void
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export function useToggle(options?: UseToggleOptions): ToggleHookReturn {
|
|
15
|
+
const [checked, setChecked] = useState<string>(options?.checked ?? '')
|
|
16
|
+
const onChange = options?.onChange
|
|
17
|
+
|
|
18
|
+
const handleChange = useCallback(
|
|
19
|
+
(e: ChangeEvent<HTMLInputElement>) => {
|
|
20
|
+
const target = e.currentTarget as HTMLInputElement
|
|
21
|
+
setChecked((prev) => {
|
|
22
|
+
return prev === target.value ? '' : target.value
|
|
23
|
+
})
|
|
24
|
+
onChange?.(e)
|
|
25
|
+
},
|
|
26
|
+
[onChange],
|
|
27
|
+
)
|
|
28
|
+
|
|
29
|
+
return useMemo(() => ({ checked, handleChange }), [checked, handleChange])
|
|
30
|
+
}
|
package/src/index.ts
CHANGED
|
@@ -13,11 +13,13 @@ export * from './components/Label'
|
|
|
13
13
|
export * from './components/NavMenuTrigger'
|
|
14
14
|
export * from './components/NavMenuList'
|
|
15
15
|
export * from './components/NavMenuLink'
|
|
16
|
+
export * from './components/Radio'
|
|
16
17
|
export * from './components/Tab'
|
|
17
18
|
export * from './components/TabList'
|
|
18
19
|
export * from './components/TabPanel'
|
|
19
20
|
export * from './components/Tag'
|
|
20
21
|
export * from './components/Textarea'
|
|
22
|
+
export * from './components/Toggle'
|
|
21
23
|
export * from './components/Show'
|
|
22
24
|
|
|
23
25
|
// context
|
|
@@ -30,12 +32,17 @@ export * from './context/theme'
|
|
|
30
32
|
// hooks
|
|
31
33
|
|
|
32
34
|
export * from './hooks/useTheme'
|
|
35
|
+
export * from './hooks/useToggle'
|
|
33
36
|
|
|
34
37
|
// aria-helpers
|
|
35
38
|
|
|
36
39
|
export * from './aria-helpers/nav-menu.aria'
|
|
37
40
|
export * from './aria-helpers/tabs.aria'
|
|
38
41
|
|
|
42
|
+
// utils
|
|
43
|
+
|
|
44
|
+
export * from './config/defineIcons'
|
|
45
|
+
|
|
39
46
|
// shared types
|
|
40
47
|
|
|
41
48
|
export * from './types'
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { useTabsKeyboardNavigation_alias_1 as useTabsKeyboardNavigation } from '../_tsup-dts-rollup';
|
|
@@ -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/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 { ConditionalValue } from '@cerberus/styled-system/types'\n\n/**\n * This module contains the tag component.\n * @module\n */\n\nexport type NonActionablePalette = ConditionalValue<\n 'neutral' | 'info' | 'success' | 'warning' | 'danger'\n>\nexport interface TagProps extends HTMLAttributes<HTMLSpanElement> {\n palette?: NonActionablePalette\n shape?: 'rounded' | 'pill'\n usage?: 'filled' | 'outline'\n}\nexport interface ClickableTagProps extends HTMLAttributes<HTMLSpanElement> {\n palette?: NonActionablePalette\n shape?: 'pill'\n onClick: () => void\n usage?: 'filled'\n}\n\n/**\n * The Tag component is used to display a meta descriptions.\n * @example\n * ```tsx\n * <Tag>Tag</Tag>\n * ```\n */\nexport function Tag(\n props: PropsWithChildren<TagProps | ClickableTagProps>,\n): JSX.Element {\n const { palette, shape: initShape, onClick, usage, ...nativeProps } = props\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;AA6C5B,SAwBM,KAxBN;AAfG,SAAS,IACd,OACa;AACb,QAAM,EAAE,SAAS,OAAO,WAAW,SAAS,OAAO,GAAG,YAAY,IAAI;AACtE,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":[]}
|
|
@@ -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 } from '@cerberus/styled-system/css'\nimport { iconButton } from '@cerberus/styled-system/recipes'\nimport type { ButtonProps } from './Button'\n\n/**\n * This module contains the Icon Button component.\n * @module\n */\n\nexport type IconButtonUsage = Exclude<ButtonProps['usage'], 'outline'>\nexport interface IconButtonProps\n extends ButtonHTMLAttributes<HTMLButtonElement> {\n ariaLabel: string\n palette?: ButtonProps['palette']\n usage?: IconButtonUsage\n shape?: 'circle'\n size?: 'sm' | 'lg'\n tooltipPosition?: 'top' | 'bottom' | 'left' | 'right'\n}\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,UAAU;AACnB,SAAS,kBAAkB;AA0BvB;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/Button.tsx"],"sourcesContent":["import type { ButtonHTMLAttributes } from 'react'\nimport { cx } 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 interface ButtonProps extends ButtonHTMLAttributes<HTMLButtonElement> {\n palette?: 'action' | 'danger'\n usage?: 'filled' | 'outline' | 'text'\n shape?: 'sharp' | 'rounded'\n}\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,UAAU;AACnB,SAAS,cAAc;AAoBnB;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":[]}
|
|
@@ -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,4 +0,0 @@
|
|
|
1
|
-
export { Tag_alias_1 as Tag } from '../_tsup-dts-rollup';
|
|
2
|
-
export { NonActionablePalette_alias_1 as NonActionablePalette } from '../_tsup-dts-rollup';
|
|
3
|
-
export { TagProps_alias_1 as TagProps } from '../_tsup-dts-rollup';
|
|
4
|
-
export { ClickableTagProps_alias_1 as ClickableTagProps } from '../_tsup-dts-rollup';
|