unicorn-design-system 1.0.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/README.md ADDED
@@ -0,0 +1,62 @@
1
+ # 🦄 Unicorn Design System
2
+
3
+ A beautiful React component library with design tokens.
4
+
5
+ ## Installation
6
+ ```bash
7
+ npm install unicorn-design-system
8
+ ```
9
+
10
+ ## Quick Start
11
+ ```tsx
12
+ import { Button, Card, Badge } from 'unicorn-design-system';
13
+
14
+ export default function App() {
15
+ return (
16
+ <Card padding="lg">
17
+ <h1>Hello Unicorn!</h1>
18
+ <Badge variant="success">Ready</Badge>
19
+ <Button variant="primary">Click Me</Button>
20
+ </Card>
21
+ );
22
+ }
23
+ ```
24
+
25
+ ## Components
26
+
27
+ - Button - Click interactions
28
+ - Card - Content containers
29
+ - Badge - Status indicators
30
+ - Input - Text input
31
+ - Modal - Dialogs
32
+ - Alert - Messages
33
+
34
+ ## Colors
35
+
36
+ - Primary: #2A6ECC (Blue)
37
+ - Success: #00995A (Green)
38
+ - Warning: #F9B02A (Amber)
39
+ - Danger: #FA5858 (Red)
40
+
41
+ ## License
42
+
43
+ MIT
44
+ ```
45
+
46
+ **What this does:** Creates a description page that shows on npm.
47
+
48
+ ---
49
+
50
+ ### **Step 8: Create LICENSE**
51
+
52
+ Create a file named `LICENSE` and paste this:
53
+ ```
54
+ MIT License
55
+
56
+ Copyright (c) 2024 Unicorn Design System
57
+
58
+ Permission is hereby granted, free of charge, to any person obtaining a copy
59
+ of this software and associated documentation files (the "Software"), to deal
60
+ in the Software without restriction, including without limitation the rights
61
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
62
+ copies of the Software.
@@ -0,0 +1,10 @@
1
+ import React from 'react';
2
+ export interface AlertProps {
3
+ type?: 'info' | 'success' | 'warning' | 'error';
4
+ title?: string;
5
+ message: string;
6
+ closable?: boolean;
7
+ onClose?: () => void;
8
+ }
9
+ export declare const Alert: React.FC<AlertProps>;
10
+ export default Alert;
@@ -0,0 +1,11 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ export const Alert = ({ type = 'info', title, message, closable, onClose, }) => {
3
+ const types = {
4
+ info: 'bg-cyan-50 border-l-4 border-cyan-500 text-cyan-900',
5
+ success: 'bg-emerald-50 border-l-4 border-emerald-500 text-emerald-900',
6
+ warning: 'bg-amber-50 border-l-4 border-amber-500 text-amber-900',
7
+ error: 'bg-red-50 border-l-4 border-red-500 text-red-900',
8
+ };
9
+ return (_jsxs("div", { className: `p-4 rounded-lg ${types[type]}`, children: [title && _jsx("h3", { className: "font-semibold mb-1", children: title }), _jsx("p", { className: "text-sm", children: message }), closable && (_jsx("button", { onClick: onClose, className: "ml-auto text-sm font-semibold hover:opacity-70", children: "\u2715" }))] }));
10
+ };
11
+ export default Alert;
@@ -0,0 +1,6 @@
1
+ import React from 'react';
2
+ export interface BadgeProps extends React.HTMLAttributes<HTMLSpanElement> {
3
+ variant?: 'primary' | 'success' | 'warning' | 'danger';
4
+ }
5
+ export declare const Badge: React.ForwardRefExoticComponent<BadgeProps & React.RefAttributes<HTMLSpanElement>>;
6
+ export default Badge;
@@ -0,0 +1,17 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import React from 'react';
3
+ export const Badge = React.forwardRef(({ variant = 'primary', className, children, ...props }, ref) => {
4
+ const variants = {
5
+ primary: 'bg-blue-100 text-blue-800',
6
+ success: 'bg-emerald-100 text-emerald-800',
7
+ warning: 'bg-amber-100 text-amber-800',
8
+ danger: 'bg-red-100 text-red-800',
9
+ };
10
+ return (_jsx("span", { ref: ref, className: `
11
+ inline-flex px-3 py-1.5 rounded-full text-sm font-semibold
12
+ ${variants[variant]}
13
+ ${className || ''}
14
+ `, ...props, children: children }));
15
+ });
16
+ Badge.displayName = 'Badge';
17
+ export default Badge;
@@ -0,0 +1,7 @@
1
+ import React from 'react';
2
+ export interface ButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {
3
+ variant?: 'primary' | 'secondary' | 'success' | 'danger';
4
+ size?: 'sm' | 'md' | 'lg';
5
+ }
6
+ export declare const Button: React.ForwardRefExoticComponent<ButtonProps & React.RefAttributes<HTMLButtonElement>>;
7
+ export default Button;
@@ -0,0 +1,23 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import React from 'react';
3
+ export const Button = React.forwardRef(({ variant = 'primary', size = 'md', className, children, ...props }, ref) => {
4
+ const variants = {
5
+ primary: 'bg-blue-600 text-white hover:bg-blue-700',
6
+ secondary: 'bg-gray-200 text-gray-900 hover:bg-gray-300',
7
+ success: 'bg-emerald-600 text-white hover:bg-emerald-700',
8
+ danger: 'bg-red-600 text-white hover:bg-red-700',
9
+ };
10
+ const sizes = {
11
+ sm: 'px-3 py-1.5 text-sm',
12
+ md: 'px-4 py-2 text-base',
13
+ lg: 'px-6 py-3 text-lg',
14
+ };
15
+ return (_jsx("button", { ref: ref, className: `
16
+ rounded-lg font-semibold transition-colors
17
+ ${variants[variant]}
18
+ ${sizes[size]}
19
+ ${className || ''}
20
+ `, ...props, children: children }));
21
+ });
22
+ Button.displayName = 'Button';
23
+ export default Button;
@@ -0,0 +1,7 @@
1
+ import React from 'react';
2
+ export interface CardProps extends React.HTMLAttributes<HTMLDivElement> {
3
+ variant?: 'default' | 'elevated' | 'flat';
4
+ padding?: 'sm' | 'md' | 'lg';
5
+ }
6
+ export declare const Card: React.ForwardRefExoticComponent<CardProps & React.RefAttributes<HTMLDivElement>>;
7
+ export default Card;
@@ -0,0 +1,22 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import React from 'react';
3
+ export const Card = React.forwardRef(({ variant = 'default', padding = 'lg', className, children, ...props }, ref) => {
4
+ const variants = {
5
+ default: 'bg-white border border-gray-200 shadow-sm',
6
+ elevated: 'bg-white shadow-lg',
7
+ flat: 'bg-gray-50 border border-gray-100',
8
+ };
9
+ const paddings = {
10
+ sm: 'p-2',
11
+ md: 'p-4',
12
+ lg: 'p-6',
13
+ };
14
+ return (_jsx("div", { ref: ref, className: `
15
+ rounded-lg transition-all
16
+ ${variants[variant]}
17
+ ${paddings[padding]}
18
+ ${className || ''}
19
+ `, ...props, children: children }));
20
+ });
21
+ Card.displayName = 'Card';
22
+ export default Card;
@@ -0,0 +1,7 @@
1
+ import React from 'react';
2
+ export interface InputProps extends React.InputHTMLAttributes<HTMLInputElement> {
3
+ label?: string;
4
+ error?: string;
5
+ }
6
+ export declare const Input: React.ForwardRefExoticComponent<InputProps & React.RefAttributes<HTMLInputElement>>;
7
+ export default Input;
@@ -0,0 +1,12 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import React from 'react';
3
+ export const Input = React.forwardRef(({ label, error, className, ...props }, ref) => {
4
+ return (_jsxs("div", { className: "w-full", children: [label && _jsx("label", { className: "block text-sm font-semibold mb-2", children: label }), _jsx("input", { ref: ref, className: `
5
+ w-full px-4 py-2 border rounded-lg
6
+ focus:outline-none focus:ring-2 focus:ring-blue-500
7
+ ${error ? 'border-red-500' : 'border-gray-300'}
8
+ ${className || ''}
9
+ `, ...props }), error && _jsx("p", { className: "text-sm text-red-600 mt-1", children: error })] }));
10
+ });
11
+ Input.displayName = 'Input';
12
+ export default Input;
@@ -0,0 +1,10 @@
1
+ import React from 'react';
2
+ export interface ModalProps {
3
+ isOpen: boolean;
4
+ onClose: () => void;
5
+ title?: string;
6
+ children: React.ReactNode;
7
+ footer?: React.ReactNode;
8
+ }
9
+ export declare const Modal: React.FC<ModalProps>;
10
+ export default Modal;
@@ -0,0 +1,7 @@
1
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
+ export const Modal = ({ isOpen, onClose, title, children, footer, }) => {
3
+ if (!isOpen)
4
+ return null;
5
+ return (_jsxs(_Fragment, { children: [_jsx("div", { className: "fixed inset-0 bg-black bg-opacity-50 z-40", onClick: onClose }), _jsx("div", { className: "fixed inset-0 z-50 flex items-center justify-center", children: _jsxs("div", { className: "bg-white rounded-lg shadow-2xl max-w-md w-full mx-4", children: [title && (_jsx("div", { className: "p-6 border-b border-gray-200", children: _jsx("h2", { className: "text-xl font-bold", children: title }) })), _jsx("div", { className: "p-6", children: children }), footer && _jsx("div", { className: "p-6 border-t border-gray-200 bg-gray-50", children: footer })] }) })] }));
6
+ };
7
+ export default Modal;
@@ -0,0 +1,15 @@
1
+ export { Button } from './components/Button';
2
+ export type { ButtonProps } from './components/Button';
3
+ export { Card } from './components/Card';
4
+ export type { CardProps } from './components/Card';
5
+ export { Badge } from './components/Badge';
6
+ export type { BadgeProps } from './components/Badge';
7
+ export { Input } from './components/Input';
8
+ export type { InputProps } from './components/Input';
9
+ export { Modal } from './components/Modal';
10
+ export type { ModalProps } from './components/Modal';
11
+ export { Alert } from './components/Alert';
12
+ export type { AlertProps } from './components/Alert';
13
+ export { colors } from './tokens/colors';
14
+ export { typography } from './tokens/typography';
15
+ export { spacing, borderRadius, shadows } from './tokens/spacing';
package/dist/index.js ADDED
@@ -0,0 +1,11 @@
1
+ // Export all components
2
+ export { Button } from './components/Button';
3
+ export { Card } from './components/Card';
4
+ export { Badge } from './components/Badge';
5
+ export { Input } from './components/Input';
6
+ export { Modal } from './components/Modal';
7
+ export { Alert } from './components/Alert';
8
+ // Export all tokens
9
+ export { colors } from './tokens/colors';
10
+ export { typography } from './tokens/typography';
11
+ export { spacing, borderRadius, shadows } from './tokens/spacing';
@@ -0,0 +1,29 @@
1
+ export declare const colors: {
2
+ primary: {
3
+ 500: string;
4
+ 600: string;
5
+ 700: string;
6
+ };
7
+ success: {
8
+ 500: string;
9
+ 600: string;
10
+ 700: string;
11
+ };
12
+ warning: {
13
+ 500: string;
14
+ 600: string;
15
+ 700: string;
16
+ };
17
+ danger: {
18
+ 500: string;
19
+ 600: string;
20
+ 700: string;
21
+ };
22
+ gray: {
23
+ 50: string;
24
+ 100: string;
25
+ 200: string;
26
+ 500: string;
27
+ 900: string;
28
+ };
29
+ };
@@ -0,0 +1,29 @@
1
+ export const colors = {
2
+ primary: {
3
+ 500: '#2A6ECC',
4
+ 600: '#235ABD',
5
+ 700: '#1C45AE',
6
+ },
7
+ success: {
8
+ 500: '#00995A',
9
+ 600: '#007A4A',
10
+ 700: '#005C3A',
11
+ },
12
+ warning: {
13
+ 500: '#F9B02A',
14
+ 600: '#E8A100',
15
+ 700: '#D69200',
16
+ },
17
+ danger: {
18
+ 500: '#FA5858',
19
+ 600: '#E84545',
20
+ 700: '#D63232',
21
+ },
22
+ gray: {
23
+ 50: '#F9FAFB',
24
+ 100: '#F3F4F6',
25
+ 200: '#E5E7EB',
26
+ 500: '#6B7280',
27
+ 900: '#111827',
28
+ },
29
+ };
@@ -0,0 +1,19 @@
1
+ export declare const spacing: {
2
+ xs: string;
3
+ sm: string;
4
+ md: string;
5
+ lg: string;
6
+ xl: string;
7
+ '2xl': string;
8
+ };
9
+ export declare const borderRadius: {
10
+ sm: string;
11
+ md: string;
12
+ lg: string;
13
+ xl: string;
14
+ };
15
+ export declare const shadows: {
16
+ sm: string;
17
+ md: string;
18
+ lg: string;
19
+ };
@@ -0,0 +1,19 @@
1
+ export const spacing = {
2
+ xs: '4px',
3
+ sm: '8px',
4
+ md: '12px',
5
+ lg: '16px',
6
+ xl: '24px',
7
+ '2xl': '32px',
8
+ };
9
+ export const borderRadius = {
10
+ sm: '4px',
11
+ md: '6px',
12
+ lg: '8px',
13
+ xl: '12px',
14
+ };
15
+ export const shadows = {
16
+ sm: '0 1px 2px 0 rgba(0, 0, 0, 0.05)',
17
+ md: '0 4px 6px -1px rgba(0, 0, 0, 0.1)',
18
+ lg: '0 10px 15px -3px rgba(0, 0, 0, 0.1)',
19
+ };
@@ -0,0 +1,21 @@
1
+ export declare const typography: {
2
+ fontFamily: {
3
+ primary: string;
4
+ mono: string;
5
+ };
6
+ fontSize: {
7
+ xs: string;
8
+ sm: string;
9
+ base: string;
10
+ lg: string;
11
+ xl: string;
12
+ '2xl': string;
13
+ '3xl': string;
14
+ };
15
+ fontWeight: {
16
+ regular: number;
17
+ medium: number;
18
+ semibold: number;
19
+ bold: number;
20
+ };
21
+ };
@@ -0,0 +1,21 @@
1
+ export const typography = {
2
+ fontFamily: {
3
+ primary: 'Poppins, -apple-system, BlinkMacSystemFont, sans-serif',
4
+ mono: '"Roboto Mono", monospace',
5
+ },
6
+ fontSize: {
7
+ xs: '10px',
8
+ sm: '12px',
9
+ base: '14px',
10
+ lg: '16px',
11
+ xl: '18px',
12
+ '2xl': '20px',
13
+ '3xl': '24px',
14
+ },
15
+ fontWeight: {
16
+ regular: 400,
17
+ medium: 500,
18
+ semibold: 600,
19
+ bold: 700,
20
+ },
21
+ };
package/package.json ADDED
@@ -0,0 +1,43 @@
1
+ {
2
+ "name": "unicorn-design-system",
3
+ "version": "1.0.0",
4
+ "description": "🦄 Beautiful React components and design tokens",
5
+ "main": "dist/index.js",
6
+ "module": "dist/index.esm.js",
7
+ "types": "dist/index.d.ts",
8
+ "exports": {
9
+ ".": {
10
+ "types": "./dist/index.d.ts",
11
+ "import": "./dist/index.esm.js",
12
+ "require": "./dist/index.js"
13
+ },
14
+ "./styles": "./dist/styles.css"
15
+ },
16
+ "files": [
17
+ "dist",
18
+ "README.md",
19
+ "LICENSE"
20
+ ],
21
+ "scripts": {
22
+ "build": "tsc",
23
+ "dev": "tsc --watch"
24
+ },
25
+ "keywords": [
26
+ "react",
27
+ "components",
28
+ "design-system",
29
+ "ui-library",
30
+ "typescript"
31
+ ],
32
+ "author": "Your Name",
33
+ "license": "MIT",
34
+ "peerDependencies": {
35
+ "react": ">=18.0.0",
36
+ "react-dom": ">=18.0.0"
37
+ },
38
+ "devDependencies": {
39
+ "@types/react": "^18.2.0",
40
+ "@types/react-dom": "^18.2.0",
41
+ "typescript": "^5.3.0"
42
+ }
43
+ }