@carandesign/drawui 0.1.0 → 0.1.2

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.
Files changed (38) hide show
  1. package/README.md +17 -66
  2. package/dist/components/button/DrawuiButton.d.ts +3 -0
  3. package/dist/components/button/DrawuiButton.types.d.ts +7 -0
  4. package/dist/components/button/index.d.ts +2 -0
  5. package/dist/components/card/DrawuiCard.d.ts +3 -0
  6. package/dist/components/card/DrawuiCard.types.d.ts +13 -0
  7. package/dist/components/card/index.d.ts +2 -0
  8. package/dist/components/collapse/DrawuiCollapse.d.ts +3 -0
  9. package/dist/components/collapse/DrawuiCollapse.types.d.ts +10 -0
  10. package/dist/components/collapse/index.d.ts +2 -0
  11. package/dist/components/divider/DrawuiDivider.d.ts +3 -0
  12. package/dist/components/divider/DrawuiDivider.types.d.ts +7 -0
  13. package/dist/components/divider/index.d.ts +2 -0
  14. package/dist/components/iconButton/DrawuiIconButton.d.ts +3 -0
  15. package/dist/components/iconButton/DrawuiIconButton.types.d.ts +8 -0
  16. package/dist/components/iconButton/index.d.ts +2 -0
  17. package/dist/components/index.d.ts +6 -0
  18. package/dist/components/input/DrawuiInput.d.ts +3 -0
  19. package/dist/components/input/DrawuiInput.types.d.ts +8 -0
  20. package/dist/components/input/index.d.ts +2 -0
  21. package/dist/icons/IconBell.d.ts +3 -0
  22. package/dist/icons/IconHome.d.ts +3 -0
  23. package/dist/icons/IconMinus.d.ts +3 -0
  24. package/dist/icons/IconPlus.d.ts +3 -0
  25. package/dist/icons/IconSearch.d.ts +3 -0
  26. package/dist/icons/IconSettings.d.ts +3 -0
  27. package/dist/icons/IconUser.d.ts +3 -0
  28. package/dist/icons/index.d.ts +7 -0
  29. package/dist/icons/types.d.ts +7 -0
  30. package/dist/index.d.ts +3 -0
  31. package/dist/theme/DrawuiThemeContext.d.ts +2 -0
  32. package/dist/theme/DrawuiThemeProvider.d.ts +6 -0
  33. package/dist/theme/defaultTheme.d.ts +2 -0
  34. package/dist/theme/index.d.ts +3 -0
  35. package/dist/theme/types.d.ts +31 -0
  36. package/dist/theme/useDrawuiTheme.d.ts +1 -0
  37. package/dist/utils/roughPaths.d.ts +1 -0
  38. package/package.json +30 -29
package/README.md CHANGED
@@ -1,73 +1,24 @@
1
- # React + TypeScript + Vite
1
+ # DrawUI
2
2
 
3
- This template provides a minimal setup to get React working in Vite with HMR and some ESLint rules.
3
+ **Sketch-style React UI component library**
4
+ DrawUI provides a set of hand-drawn sketch-inspired UI components for React, including Buttons, IconButtons, Cards, Inputs, Collapsibles, Dividers, and a library of reusable SVG icons.
4
5
 
5
- Currently, two official plugins are available:
6
+ ---
6
7
 
7
- - [@vitejs/plugin-react](https://github.com/vitejs/vite-plugin-react/blob/main/packages/plugin-react) uses [Babel](https://babeljs.io/) (or [oxc](https://oxc.rs) when used in [rolldown-vite](https://vite.dev/guide/rolldown)) for Fast Refresh
8
- - [@vitejs/plugin-react-swc](https://github.com/vitejs/vite-plugin-react/blob/main/packages/plugin-react-swc) uses [SWC](https://swc.rs/) for Fast Refresh
8
+ ## Features
9
9
 
10
- ## React Compiler
10
+ - Hand-drawn sketch style using `roughjs`
11
+ - Themeable: colors, stroke widths, radii, roughness
12
+ - Fully typed with TypeScript
13
+ - Ready-to-use Icons in SVG
14
+ - Supports different sizes and variants
15
+ - Flexible: header/footer support for Cards, collapsible content, icon buttons
11
16
 
12
- The React Compiler is not enabled on this template because of its impact on dev & build performances. To add it, see [this documentation](https://react.dev/learn/react-compiler/installation).
17
+ ---
13
18
 
14
- ## Expanding the ESLint configuration
19
+ ## Installation
15
20
 
16
- If you are developing a production application, we recommend updating the configuration to enable type-aware lint rules:
17
-
18
- ```js
19
- export default defineConfig([
20
- globalIgnores(['dist']),
21
- {
22
- files: ['**/*.{ts,tsx}'],
23
- extends: [
24
- // Other configs...
25
-
26
- // Remove tseslint.configs.recommended and replace with this
27
- tseslint.configs.recommendedTypeChecked,
28
- // Alternatively, use this for stricter rules
29
- tseslint.configs.strictTypeChecked,
30
- // Optionally, add this for stylistic rules
31
- tseslint.configs.stylisticTypeChecked,
32
-
33
- // Other configs...
34
- ],
35
- languageOptions: {
36
- parserOptions: {
37
- project: ['./tsconfig.node.json', './tsconfig.app.json'],
38
- tsconfigRootDir: import.meta.dirname,
39
- },
40
- // other options...
41
- },
42
- },
43
- ])
44
- ```
45
-
46
- You can also install [eslint-plugin-react-x](https://github.com/Rel1cx/eslint-react/tree/main/packages/plugins/eslint-plugin-react-x) and [eslint-plugin-react-dom](https://github.com/Rel1cx/eslint-react/tree/main/packages/plugins/eslint-plugin-react-dom) for React-specific lint rules:
47
-
48
- ```js
49
- // eslint.config.js
50
- import reactX from 'eslint-plugin-react-x'
51
- import reactDom from 'eslint-plugin-react-dom'
52
-
53
- export default defineConfig([
54
- globalIgnores(['dist']),
55
- {
56
- files: ['**/*.{ts,tsx}'],
57
- extends: [
58
- // Other configs...
59
- // Enable lint rules for React
60
- reactX.configs['recommended-typescript'],
61
- // Enable lint rules for React DOM
62
- reactDom.configs.recommended,
63
- ],
64
- languageOptions: {
65
- parserOptions: {
66
- project: ['./tsconfig.node.json', './tsconfig.app.json'],
67
- tsconfigRootDir: import.meta.dirname,
68
- },
69
- // other options...
70
- },
71
- },
72
- ])
73
- ```
21
+ ```bash
22
+ npm install @carandesign/drawui
23
+ # or
24
+ yarn add @carandesign/drawui
@@ -0,0 +1,3 @@
1
+ import { default as React } from 'react';
2
+ import { DrawuiButtonProps } from './DrawuiButton.types';
3
+ export declare const DrawuiButton: React.FC<DrawuiButtonProps>;
@@ -0,0 +1,7 @@
1
+ import { RadiusToken, SizeToken, StrokeWeight } from '../../theme/types';
2
+ export interface DrawuiButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {
3
+ strokeWeight?: StrokeWeight;
4
+ size?: SizeToken;
5
+ radius?: RadiusToken;
6
+ backgroundColor?: string;
7
+ }
@@ -0,0 +1,2 @@
1
+ export { DrawuiButton } from './DrawuiButton';
2
+ export * from './DrawuiButton.types';
@@ -0,0 +1,3 @@
1
+ import { default as React } from 'react';
2
+ import { DrawuiCardProps } from './DrawuiCard.types';
3
+ export declare const DrawuiCard: React.FC<DrawuiCardProps>;
@@ -0,0 +1,13 @@
1
+ import { RadiusToken, StrokeWeight } from '../../theme/types';
2
+ import { ReactNode } from 'react';
3
+ export interface DrawuiCardProps {
4
+ strokeWeight?: StrokeWeight;
5
+ radius?: RadiusToken;
6
+ width?: number;
7
+ height?: number;
8
+ backgroundColor?: string;
9
+ header?: ReactNode;
10
+ footer?: ReactNode;
11
+ children?: ReactNode;
12
+ className?: string;
13
+ }
@@ -0,0 +1,2 @@
1
+ export { DrawuiCard } from './DrawuiCard';
2
+ export * from './DrawuiCard.types';
@@ -0,0 +1,3 @@
1
+ import { default as React } from 'react';
2
+ import { DrawuiCollapseProps } from './DrawuiCollapse.types';
3
+ export declare const DrawuiCollapse: React.FC<DrawuiCollapseProps>;
@@ -0,0 +1,10 @@
1
+ import { ReactNode } from 'react';
2
+ import { RadiusToken, StrokeWeight } from '../../theme/types';
3
+ export interface DrawuiCollapseProps {
4
+ header: ReactNode;
5
+ children: ReactNode;
6
+ strokeWeight?: StrokeWeight;
7
+ radius?: RadiusToken;
8
+ className?: string;
9
+ width?: number;
10
+ }
@@ -0,0 +1,2 @@
1
+ export { DrawuiCollapse } from './DrawuiCollapse';
2
+ export * from './DrawuiCollapse.types';
@@ -0,0 +1,3 @@
1
+ import { default as React } from 'react';
2
+ import { DrawuiDividerProps } from './DrawuiDivider.types';
3
+ export declare const DrawuiDivider: React.FC<DrawuiDividerProps>;
@@ -0,0 +1,7 @@
1
+ import { StrokeWeight } from '../../theme/types';
2
+ export interface DrawuiDividerProps {
3
+ strokeWeight?: StrokeWeight;
4
+ width?: number | string;
5
+ vertical?: boolean;
6
+ className?: string;
7
+ }
@@ -0,0 +1,2 @@
1
+ export { DrawuiDivider } from './DrawuiDivider';
2
+ export * from './DrawuiDivider.types';
@@ -0,0 +1,3 @@
1
+ import { default as React } from 'react';
2
+ import { DrawuiIconButtonProps } from './DrawuiIconButton.types';
3
+ export declare const DrawuiIconButton: React.FC<DrawuiIconButtonProps>;
@@ -0,0 +1,8 @@
1
+ import { RadiusToken, SizeToken, StrokeWeight } from '../../theme/types';
2
+ export interface DrawuiIconButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {
3
+ strokeWeight?: StrokeWeight;
4
+ size?: SizeToken;
5
+ icon: React.ReactNode;
6
+ radius?: RadiusToken;
7
+ backgroundColor?: string;
8
+ }
@@ -0,0 +1,2 @@
1
+ export { DrawuiIconButton } from './DrawuiIconButton';
2
+ export * from './DrawuiIconButton.types';
@@ -0,0 +1,6 @@
1
+ export * from './button';
2
+ export * from './card';
3
+ export * from './collapse';
4
+ export * from './divider';
5
+ export * from './iconButton';
6
+ export * from './input';
@@ -0,0 +1,3 @@
1
+ import { default as React } from 'react';
2
+ import { DrawuiInputProps } from './DrawuiInput.types';
3
+ export declare const DrawuiInput: React.FC<DrawuiInputProps>;
@@ -0,0 +1,8 @@
1
+ import { StrokeWeight, RadiusToken, SizeToken } from '../../theme/types';
2
+ import { InputHTMLAttributes } from 'react';
3
+ export interface DrawuiInputProps extends InputHTMLAttributes<HTMLInputElement> {
4
+ strokeWeight?: StrokeWeight;
5
+ radius?: RadiusToken;
6
+ inputSize: SizeToken;
7
+ backgroundColor?: string;
8
+ }
@@ -0,0 +1,2 @@
1
+ export { DrawuiInput } from './DrawuiInput';
2
+ export * from './DrawuiInput.types';
@@ -0,0 +1,3 @@
1
+ import { default as React } from 'react';
2
+ import { DrawuiIconProps } from './types';
3
+ export declare const IconBell: React.FC<DrawuiIconProps>;
@@ -0,0 +1,3 @@
1
+ import { default as React } from 'react';
2
+ import { DrawuiIconProps } from './types';
3
+ export declare const IconHome: React.FC<DrawuiIconProps>;
@@ -0,0 +1,3 @@
1
+ import { default as React } from 'react';
2
+ import { DrawuiIconProps } from './types';
3
+ export declare const IconMinus: React.FC<DrawuiIconProps>;
@@ -0,0 +1,3 @@
1
+ import { default as React } from 'react';
2
+ import { DrawuiIconProps } from './types';
3
+ export declare const IconPlus: React.FC<DrawuiIconProps>;
@@ -0,0 +1,3 @@
1
+ import { default as React } from 'react';
2
+ import { DrawuiIconProps } from './types';
3
+ export declare const IconSearch: React.FC<DrawuiIconProps>;
@@ -0,0 +1,3 @@
1
+ import { default as React } from 'react';
2
+ import { DrawuiIconProps } from './types';
3
+ export declare const IconSettings: React.FC<DrawuiIconProps>;
@@ -0,0 +1,3 @@
1
+ import { default as React } from 'react';
2
+ import { DrawuiIconProps } from './types';
3
+ export declare const IconUser: React.FC<DrawuiIconProps>;
@@ -0,0 +1,7 @@
1
+ export { IconBell } from './IconBell';
2
+ export { IconHome } from './IconHome';
3
+ export { IconMinus } from './IconMinus';
4
+ export { IconPlus } from './IconPlus';
5
+ export { IconSearch } from './IconSearch';
6
+ export { IconSettings } from './IconSettings';
7
+ export { IconUser } from './IconUser';
@@ -0,0 +1,7 @@
1
+ import { StrokeWeight } from '../theme/types';
2
+ export interface DrawuiIconProps {
3
+ size?: number;
4
+ strokeWeight?: StrokeWeight;
5
+ color?: string;
6
+ className?: string;
7
+ }
@@ -0,0 +1,3 @@
1
+ export * from './components';
2
+ export * from './icons';
3
+ export * from './theme';
@@ -0,0 +1,2 @@
1
+ import { DrawuiTheme } from './types';
2
+ export declare const DrawuiThemeContext: import('react').Context<DrawuiTheme>;
@@ -0,0 +1,6 @@
1
+ import { default as React } from 'react';
2
+ import { DrawuiTheme } from './types';
3
+ export declare const DrawuiThemeProvider: React.FC<{
4
+ theme?: Partial<DrawuiTheme>;
5
+ children: React.ReactNode;
6
+ }>;
@@ -0,0 +1,2 @@
1
+ import { DrawuiTheme } from './types';
2
+ export declare const defaultDrawuiTheme: DrawuiTheme;
@@ -0,0 +1,3 @@
1
+ export { DrawuiThemeProvider } from './DrawuiThemeProvider';
2
+ export { useDrawuiTheme } from './useDrawuiTheme';
3
+ export * from './types';
@@ -0,0 +1,31 @@
1
+ export type StrokeWeight = "thin" | "medium" | "thick";
2
+ export type RadiusToken = "none" | "sm" | "md" | "lg" | "full";
3
+ export type SizeToken = "sm" | "md" | "lg" | "xl";
4
+ export interface DrawuiButtonSize {
5
+ width: number;
6
+ height: number;
7
+ fontSize: number;
8
+ }
9
+ export interface DrawuiInputSize {
10
+ height: number;
11
+ fontSize: number;
12
+ paddingX: number;
13
+ }
14
+ export interface DrawuiStroke {
15
+ color: string;
16
+ width: number;
17
+ }
18
+ export interface DrawuiRoughness {
19
+ roughness: number;
20
+ bowing: number;
21
+ }
22
+ export interface DrawuiTheme {
23
+ stroke: Record<StrokeWeight, DrawuiStroke>;
24
+ roughness: DrawuiRoughness;
25
+ fill: {
26
+ background: string;
27
+ };
28
+ radius: Record<RadiusToken, number>;
29
+ buttonSize: Record<SizeToken, DrawuiButtonSize>;
30
+ inputSize: Record<SizeToken, DrawuiInputSize>;
31
+ }
@@ -0,0 +1 @@
1
+ export declare const useDrawuiTheme: () => import('./types').DrawuiTheme;
@@ -0,0 +1 @@
1
+ export declare const roundedRect: (x: number, y: number, width: number, height: number, r: number) => string;
package/package.json CHANGED
@@ -1,31 +1,32 @@
1
1
  {
2
- "name": "@carandesign/drawui",
3
- "version": "0.1.0",
4
- "description": "Sketch-style React UI component library",
5
- "type": "module",
6
- "main": "dist/drawui.cjs.js",
7
- "module": "dist/drawui.es.js",
8
- "types": "dist/index.d.ts",
9
- "files": ["dist"],
10
- "sideEffects": false,
11
- "scripts": {
12
- "build": "vite build",
13
- "prepublishOnly": "npm run build"
14
- },
15
- "peerDependencies": {
16
- "react": "^18 || ^19",
17
- "react-dom": "^18 || ^19"
18
- },
19
- "dependencies": {
20
- "roughjs": "^4.6.6"
21
- },
22
- "devDependencies": {
23
- "@types/react": "^19.2.5",
24
- "@types/react-dom": "^19.2.3",
25
- "@vitejs/plugin-react": "^5.1.1",
26
- "vite": "^7.2.4",
27
- "vite-plugin-dts": "^4.5.4",
28
- "typescript": "~5.9.3",
29
- "eslint": "^9.39.1"
30
- }
2
+ "name": "@carandesign/drawui",
3
+ "version": "0.1.2",
4
+ "description": "Sketch-style React UI component library",
5
+ "type": "module",
6
+ "main": "dist/drawui.cjs.js",
7
+ "module": "dist/drawui.es.js",
8
+ "types": "dist/index.d.ts",
9
+ "files": [
10
+ "dist"
11
+ ],
12
+ "scripts": {
13
+ "build": "vite build",
14
+ "prepublishOnly": "npm run build"
15
+ },
16
+ "peerDependencies": {
17
+ "react": "^18 || ^19",
18
+ "react-dom": "^18 || ^19"
19
+ },
20
+ "dependencies": {
21
+ "roughjs": "^4.6.6"
22
+ },
23
+ "devDependencies": {
24
+ "@types/react": "^19.2.5",
25
+ "@types/react-dom": "^19.2.3",
26
+ "@vitejs/plugin-react": "^5.1.1",
27
+ "vite": "^7.2.4",
28
+ "vite-plugin-dts": "^4.5.4",
29
+ "typescript": "~5.9.3",
30
+ "eslint": "^9.39.1"
31
+ }
31
32
  }