@openzeppelin/ui-components 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,148 @@
1
+ # @openzeppelin/ui-components
2
+
3
+ Shared React UI components for the OpenZeppelin UI ecosystem.
4
+
5
+ [![npm version](https://img.shields.io/npm/v/@openzeppelin/ui-components.svg)](https://www.npmjs.com/package/@openzeppelin/ui-components)
6
+
7
+ ## Installation
8
+
9
+ ```bash
10
+ # Using npm
11
+ npm install @openzeppelin/ui-components
12
+
13
+ # Using yarn
14
+ yarn add @openzeppelin/ui-components
15
+
16
+ # Using pnpm
17
+ pnpm add @openzeppelin/ui-components
18
+ ```
19
+
20
+ ## Peer Dependencies
21
+
22
+ This package requires React 19:
23
+
24
+ ```bash
25
+ pnpm add react react-dom
26
+ ```
27
+
28
+ ## Overview
29
+
30
+ This package provides a comprehensive set of shared React UI components. It serves as the central library for all common UI elements, including basic primitives, form field components, and their associated utilities.
31
+
32
+ All components are built with React, TypeScript, and styled with Tailwind CSS, following the shadcn/ui patterns and design principles.
33
+
34
+ ## Key Component Categories
35
+
36
+ ### Basic UI Primitives
37
+
38
+ - `Button`, `LoadingButton` - Action buttons with variants
39
+ - `Input`, `Textarea` - Text input components
40
+ - `Label` - Form labels
41
+ - `Card` (and its parts) - Container components
42
+ - `Dialog` (and its parts) - Modal dialogs
43
+ - `Alert` (and its parts) - Alert messages
44
+ - `Checkbox`, `RadioGroup` - Selection inputs
45
+ - `Select` (and its parts) - Dropdown selects
46
+ - `Progress` - Progress indicators
47
+ - `Tabs` - Tab navigation
48
+ - `Tooltip` - Hover tooltips
49
+
50
+ ### Field Components
51
+
52
+ Specialized components designed for use within `react-hook-form`:
53
+
54
+ - `AddressField` - Blockchain address input with validation
55
+ - `AmountField` - Token amount input
56
+ - `BaseField` - Foundational component for creating new field types
57
+ - `BooleanField` - Checkbox/toggle inputs
58
+ - `NumberField` - Numeric inputs
59
+ - `RadioField` - Radio button groups
60
+ - `SelectField` - Dropdown selections
61
+ - `SelectGroupedField` - Grouped dropdown selections
62
+ - `TextAreaField` - Multi-line text inputs
63
+ - `TextField` - Single-line text inputs
64
+
65
+ ### Field Utilities
66
+
67
+ Helper functions for validation, accessibility, and layout within field components.
68
+
69
+ ### Styling Utilities
70
+
71
+ Such as `buttonVariants` for `class-variance-authority`.
72
+
73
+ ## Usage
74
+
75
+ Components and utilities can be imported directly from this package:
76
+
77
+ ```tsx
78
+ import { Control, useForm } from 'react-hook-form';
79
+
80
+ import { Button, TextField, type TextFieldProps } from '@openzeppelin/ui-components';
81
+
82
+ interface MyFormData {
83
+ name: string;
84
+ }
85
+
86
+ function MyCustomForm() {
87
+ const { control } = useForm<MyFormData>();
88
+
89
+ return (
90
+ <form className="space-y-4">
91
+ <TextField
92
+ id="name"
93
+ name="name"
94
+ label="Full Name"
95
+ control={control as Control<FieldValues>}
96
+ placeholder="Enter your full name"
97
+ />
98
+ <Button type="submit">Submit</Button>
99
+ </form>
100
+ );
101
+ }
102
+ ```
103
+
104
+ ## Package Structure
105
+
106
+ ```text
107
+ components/
108
+ ├── src/
109
+ │ ├── components/
110
+ │ │ ├── ui/ # Basic UI primitives
111
+ │ │ └── fields/ # Specialized form field components
112
+ │ ├── hooks/ # Shared UI hooks
113
+ │ ├── lib/ # Utility functions and configurations
114
+ │ └── index.ts # Main package exports
115
+ ├── package.json
116
+ ├── tsconfig.json
117
+ ├── tsdown.config.ts
118
+ ├── vitest.config.ts
119
+ └── README.md
120
+ ```
121
+
122
+ ## Styling
123
+
124
+ Components are styled using Tailwind CSS. The necessary Tailwind configuration is expected to be present in the consuming application. The UI package itself does not bundle CSS but provides the class names and structure.
125
+
126
+ Import the shared styles from `@openzeppelin/ui-styles`:
127
+
128
+ ```css
129
+ @import '@openzeppelin/ui-styles/global.css';
130
+ @import 'tailwindcss';
131
+ ```
132
+
133
+ ## Development
134
+
135
+ ```bash
136
+ # Build the package
137
+ pnpm build
138
+
139
+ # Run tests
140
+ pnpm test
141
+
142
+ # Lint
143
+ pnpm lint
144
+ ```
145
+
146
+ ## License
147
+
148
+ [AGPL-3.0](https://github.com/OpenZeppelin/openzeppelin-ui/blob/main/LICENSE)