@zerodev/react-ui 0.0.1
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/README.md +89 -0
- package/dist/_types/components/Badge/index.d.ts +10 -0
- package/dist/_types/components/Badge/index.d.ts.map +1 -0
- package/dist/_types/components/Button/index.d.ts +10 -0
- package/dist/_types/components/Button/index.d.ts.map +1 -0
- package/dist/_types/components/Callout/index.d.ts +6 -0
- package/dist/_types/components/Callout/index.d.ts.map +1 -0
- package/dist/_types/components/Icon/index.d.ts +9 -0
- package/dist/_types/components/Icon/index.d.ts.map +1 -0
- package/dist/_types/components/IconButton/index.d.ts +7 -0
- package/dist/_types/components/IconButton/index.d.ts.map +1 -0
- package/dist/_types/components/Input/index.d.ts +13 -0
- package/dist/_types/components/Input/index.d.ts.map +1 -0
- package/dist/_types/components/ListItem/index.d.ts +23 -0
- package/dist/_types/components/ListItem/index.d.ts.map +1 -0
- package/dist/_types/components/Switch/index.d.ts +6 -0
- package/dist/_types/components/Switch/index.d.ts.map +1 -0
- package/dist/_types/components/Text/index.d.ts +8 -0
- package/dist/_types/components/Text/index.d.ts.map +1 -0
- package/dist/_types/components/WrappedPressable/index.d.ts +7 -0
- package/dist/_types/components/WrappedPressable/index.d.ts.map +1 -0
- package/dist/_types/components/Wrapper/index.d.ts +7 -0
- package/dist/_types/components/Wrapper/index.d.ts.map +1 -0
- package/dist/_types/index.d.ts +17 -0
- package/dist/_types/index.d.ts.map +1 -0
- package/dist/_types/utils/common.d.ts +3 -0
- package/dist/_types/utils/common.d.ts.map +1 -0
- package/dist/index.cjs +2 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.mjs +3751 -0
- package/dist/index.mjs.map +1 -0
- package/dist/styles.css +2 -0
- package/package.json +84 -0
- package/src/components/Badge/index.tsx +45 -0
- package/src/components/Button/index.tsx +81 -0
- package/src/components/Callout/index.tsx +23 -0
- package/src/components/Icon/index.tsx +43 -0
- package/src/components/IconButton/index.tsx +24 -0
- package/src/components/Input/index.tsx +147 -0
- package/src/components/ListItem/index.tsx +136 -0
- package/src/components/Switch/index.tsx +35 -0
- package/src/components/Text/index.tsx +20 -0
- package/src/components/WrappedPressable/index.tsx +46 -0
- package/src/components/Wrapper/index.tsx +43 -0
- package/src/index.ts +33 -0
- package/src/svg.d.ts +6 -0
- package/src/utils/common.ts +17 -0
- package/tailwind.config.ts +58 -0
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { type ButtonHTMLAttributes, type ReactNode, useState } from 'react'
|
|
2
|
+
|
|
3
|
+
import { cn } from '../../utils/common'
|
|
4
|
+
import { Wrapper } from '../Wrapper'
|
|
5
|
+
|
|
6
|
+
export interface WrappedPressableProps
|
|
7
|
+
extends ButtonHTMLAttributes<HTMLButtonElement> {
|
|
8
|
+
className?: string
|
|
9
|
+
children: ReactNode
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export function WrappedPressable({
|
|
13
|
+
className,
|
|
14
|
+
children,
|
|
15
|
+
onMouseEnter,
|
|
16
|
+
onMouseLeave,
|
|
17
|
+
...rest
|
|
18
|
+
}: WrappedPressableProps) {
|
|
19
|
+
const [isHovered, setIsHovered] = useState(false)
|
|
20
|
+
|
|
21
|
+
return (
|
|
22
|
+
<Wrapper
|
|
23
|
+
className={cn(
|
|
24
|
+
'zd:rounded-xl zd:flex zd:items-center zd:justify-center',
|
|
25
|
+
className,
|
|
26
|
+
)}
|
|
27
|
+
variant={isHovered ? 'soft' : 'ghost'}
|
|
28
|
+
>
|
|
29
|
+
<button
|
|
30
|
+
type="button"
|
|
31
|
+
className="zd:flex zd:flex-row zd:items-center zd:justify-center zd:gap-2 zd:w-full zd:h-full zd:cursor-pointer"
|
|
32
|
+
onMouseEnter={(e) => {
|
|
33
|
+
setIsHovered(true)
|
|
34
|
+
onMouseEnter?.(e)
|
|
35
|
+
}}
|
|
36
|
+
onMouseLeave={(e) => {
|
|
37
|
+
setIsHovered(false)
|
|
38
|
+
onMouseLeave?.(e)
|
|
39
|
+
}}
|
|
40
|
+
{...rest}
|
|
41
|
+
>
|
|
42
|
+
{children}
|
|
43
|
+
</button>
|
|
44
|
+
</Wrapper>
|
|
45
|
+
)
|
|
46
|
+
}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import type { HTMLAttributes, PropsWithChildren } from 'react'
|
|
2
|
+
|
|
3
|
+
import { cn } from '../../utils/common'
|
|
4
|
+
|
|
5
|
+
export type WrapperVariant = 'ghost' | 'soft' | 'solid'
|
|
6
|
+
|
|
7
|
+
export interface WrapperProps extends HTMLAttributes<HTMLDivElement> {
|
|
8
|
+
variant?: WrapperVariant
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
function getBackgroundAlpha(variant: WrapperVariant): number {
|
|
12
|
+
switch (variant) {
|
|
13
|
+
case 'ghost':
|
|
14
|
+
return 0.2
|
|
15
|
+
case 'soft':
|
|
16
|
+
return 0.5
|
|
17
|
+
case 'solid':
|
|
18
|
+
return 0.8
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export function Wrapper({
|
|
23
|
+
className,
|
|
24
|
+
children,
|
|
25
|
+
variant = 'soft',
|
|
26
|
+
...rest
|
|
27
|
+
}: PropsWithChildren<WrapperProps>) {
|
|
28
|
+
const backgroundAlpha = getBackgroundAlpha(variant)
|
|
29
|
+
const backgroundColor = `rgba(255, 255, 255, ${backgroundAlpha})`
|
|
30
|
+
|
|
31
|
+
return (
|
|
32
|
+
<div
|
|
33
|
+
className={cn(
|
|
34
|
+
'zd:overflow-hidden zd:border-offWhite zd:border-[0.3px] zd:backdrop-blur-[15px]',
|
|
35
|
+
className,
|
|
36
|
+
)}
|
|
37
|
+
{...rest}
|
|
38
|
+
style={{ backgroundColor, ...rest.style }}
|
|
39
|
+
>
|
|
40
|
+
{children}
|
|
41
|
+
</div>
|
|
42
|
+
)
|
|
43
|
+
}
|
package/src/index.ts
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @zerodev/react-ui
|
|
3
|
+
* React UI primitives for ZeroDev
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
export { Badge, type BadgeProps } from './components/Badge'
|
|
7
|
+
export { Button, type ButtonProps } from './components/Button'
|
|
8
|
+
export { Callout, type CalloutProps } from './components/Callout'
|
|
9
|
+
export {
|
|
10
|
+
Icon,
|
|
11
|
+
type IconName,
|
|
12
|
+
type IconProps,
|
|
13
|
+
icons,
|
|
14
|
+
} from './components/Icon'
|
|
15
|
+
export { IconButton, type IconButtonProps } from './components/IconButton'
|
|
16
|
+
export { Input, type InputProps } from './components/Input'
|
|
17
|
+
export {
|
|
18
|
+
ListItem,
|
|
19
|
+
type ListItemProps,
|
|
20
|
+
ListItemSkeleton,
|
|
21
|
+
} from './components/ListItem'
|
|
22
|
+
export { Switch, type SwitchProps } from './components/Switch'
|
|
23
|
+
export { Text, type TextProps } from './components/Text'
|
|
24
|
+
export {
|
|
25
|
+
WrappedPressable,
|
|
26
|
+
type WrappedPressableProps,
|
|
27
|
+
} from './components/WrappedPressable'
|
|
28
|
+
export {
|
|
29
|
+
Wrapper,
|
|
30
|
+
type WrapperProps,
|
|
31
|
+
type WrapperVariant,
|
|
32
|
+
} from './components/Wrapper'
|
|
33
|
+
export { cn } from './utils/common'
|
package/src/svg.d.ts
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { type ClassValue, clsx } from 'clsx'
|
|
2
|
+
import { extendTailwindMerge } from 'tailwind-merge'
|
|
3
|
+
|
|
4
|
+
const customTwMerge = extendTailwindMerge({
|
|
5
|
+
prefix: 'zd',
|
|
6
|
+
extend: {
|
|
7
|
+
classGroups: {
|
|
8
|
+
'font-size': [
|
|
9
|
+
{ text: ['h1', 'h2', 'h3', 'body1', 'body2', 'body3', 'body4'] },
|
|
10
|
+
],
|
|
11
|
+
},
|
|
12
|
+
},
|
|
13
|
+
})
|
|
14
|
+
|
|
15
|
+
export function cn(...inputs: ClassValue[]) {
|
|
16
|
+
return customTwMerge(clsx(inputs))
|
|
17
|
+
}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import type { Config } from 'tailwindcss'
|
|
2
|
+
|
|
3
|
+
const config: Config = {
|
|
4
|
+
content: ['./src/**/*.{js,ts,jsx,tsx}'],
|
|
5
|
+
theme: {
|
|
6
|
+
extend: {
|
|
7
|
+
spacing: {
|
|
8
|
+
13: '52px',
|
|
9
|
+
4.5: '18px',
|
|
10
|
+
},
|
|
11
|
+
colors: {
|
|
12
|
+
// Design color palette START
|
|
13
|
+
orange: '#F27B3E',
|
|
14
|
+
solarOrange: '#E76000',
|
|
15
|
+
paleOrange: '#FAC8AB',
|
|
16
|
+
lightOrange: '#FCE8D8',
|
|
17
|
+
skyBlue: '#45ABFB',
|
|
18
|
+
greyBrown: '#B78C71',
|
|
19
|
+
warmGrey: '#E3CFC3',
|
|
20
|
+
offWhite: '#F7F5F0',
|
|
21
|
+
greyScale: '#130E0B',
|
|
22
|
+
positive: '#228300',
|
|
23
|
+
negative: '#FF4221',
|
|
24
|
+
},
|
|
25
|
+
fontSize: {
|
|
26
|
+
xs: '10px',
|
|
27
|
+
sm: '12px',
|
|
28
|
+
base: '14px',
|
|
29
|
+
lg: '16px',
|
|
30
|
+
xl: '18px',
|
|
31
|
+
'2xl': '20px',
|
|
32
|
+
'3xl': '24px',
|
|
33
|
+
'4xl': '30px',
|
|
34
|
+
'5xl': '36px',
|
|
35
|
+
'6xl': '48px',
|
|
36
|
+
// Design typography START
|
|
37
|
+
h1: ['42px', '110%'],
|
|
38
|
+
h2: ['28px', '110%'],
|
|
39
|
+
h3: ['18px', '130%'],
|
|
40
|
+
body1: ['16px', '130%'],
|
|
41
|
+
body2: ['14px', '130%'],
|
|
42
|
+
body3: ['12px', '130%'],
|
|
43
|
+
body4: ['10px', '130%'],
|
|
44
|
+
// Design typography END
|
|
45
|
+
},
|
|
46
|
+
fontFamily: {
|
|
47
|
+
sans: ['sans-serif'],
|
|
48
|
+
heading: ['sans-serif'],
|
|
49
|
+
body: ['sans-serif'],
|
|
50
|
+
mono: undefined,
|
|
51
|
+
roboto: ['Roboto', 'sans-serif'],
|
|
52
|
+
},
|
|
53
|
+
},
|
|
54
|
+
},
|
|
55
|
+
plugins: [],
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
export default config
|