@tunjiadeyemi/ui 1.1.0 → 1.2.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 +109 -10
- package/dist/index.d.mts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +4 -4
- package/dist/index.mjs +2 -2
- package/dist/styles.css +3 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -19,24 +19,33 @@ yarn add @tunjiadeyemi/ui framer-motion lucide-react
|
|
|
19
19
|
First, import the styles in your app's entry point (e.g., `App.tsx` or `main.tsx`):
|
|
20
20
|
|
|
21
21
|
```tsx
|
|
22
|
-
import
|
|
22
|
+
import "@tunjiadeyemi/ui/styles.css";
|
|
23
23
|
```
|
|
24
24
|
|
|
25
25
|
Then use the components:
|
|
26
26
|
|
|
27
27
|
```tsx
|
|
28
|
-
import { Modal } from
|
|
29
|
-
import { useState } from
|
|
28
|
+
import { Modal, Input, Skeleton } from "@tunjiadeyemi/ui";
|
|
29
|
+
import { useState } from "react";
|
|
30
30
|
|
|
31
31
|
function App() {
|
|
32
32
|
const [showModal, setShowModal] = useState(false);
|
|
33
|
+
const [email, setEmail] = useState("");
|
|
33
34
|
|
|
34
35
|
return (
|
|
35
36
|
<>
|
|
37
|
+
<Input
|
|
38
|
+
type="email"
|
|
39
|
+
value={email}
|
|
40
|
+
onChange={(e) => setEmail(e.target.value)}
|
|
41
|
+
placeholder="Enter your email"
|
|
42
|
+
validate={true}
|
|
43
|
+
/>
|
|
44
|
+
|
|
36
45
|
<button onClick={() => setShowModal(true)}>Open Modal</button>
|
|
37
|
-
|
|
38
|
-
<Modal
|
|
39
|
-
showModal={showModal}
|
|
46
|
+
|
|
47
|
+
<Modal
|
|
48
|
+
showModal={showModal}
|
|
40
49
|
onClose={() => setShowModal(false)}
|
|
41
50
|
revealMode="fade"
|
|
42
51
|
className="bg-white p-8 rounded-lg max-w-md"
|
|
@@ -44,24 +53,114 @@ function App() {
|
|
|
44
53
|
<h2 className="text-2xl font-bold mb-4">Modal Title</h2>
|
|
45
54
|
<p>Modal content goes here</p>
|
|
46
55
|
</Modal>
|
|
56
|
+
|
|
57
|
+
<Skeleton width="200px" height="20px" animation="pulse" />
|
|
47
58
|
</>
|
|
48
59
|
);
|
|
49
60
|
}
|
|
50
61
|
```
|
|
51
62
|
|
|
52
|
-
|
|
63
|
+
## Available Components
|
|
53
64
|
|
|
54
|
-
|
|
65
|
+
### Modal
|
|
55
66
|
|
|
56
|
-
A flexible modal component with multiple reveal animations.
|
|
67
|
+
A flexible modal component with multiple reveal animations and optional drag-to-dismiss.
|
|
57
68
|
|
|
58
69
|
**Props:**
|
|
70
|
+
|
|
59
71
|
- `showModal` (boolean): Controls modal visibility
|
|
60
72
|
- `onClose` (function): Callback when modal is closed
|
|
61
|
-
- `revealMode` ('fade' | 'slide-right' | 'slide-bottom'): Animation style
|
|
73
|
+
- `revealMode` ('fade' | 'slide-right' | 'slide-bottom'): Animation style - Default: `'fade'`
|
|
74
|
+
- `isDrag` (boolean): Enable drag to dismiss (for slide-bottom mode) - Default: `false`
|
|
62
75
|
- `className` (string): Custom classes for the modal content
|
|
63
76
|
- `children` (ReactNode): Modal content
|
|
64
77
|
|
|
78
|
+
**Example:**
|
|
79
|
+
|
|
80
|
+
```tsx
|
|
81
|
+
<Modal
|
|
82
|
+
showModal={true}
|
|
83
|
+
onClose={() => console.log("Modal closed")}
|
|
84
|
+
revealMode="slide-bottom"
|
|
85
|
+
isDrag={true}
|
|
86
|
+
className="bg-white p-6 rounded-lg"
|
|
87
|
+
>
|
|
88
|
+
<h2>Your Content</h2>
|
|
89
|
+
</Modal>
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
### Input
|
|
93
|
+
|
|
94
|
+
A customizable input component with built-in validation, password visibility toggle, and OTP support.
|
|
95
|
+
|
|
96
|
+
**Props:**
|
|
97
|
+
|
|
98
|
+
- `type` ('text' | 'email' | 'password' | 'otp' | 'number'): Input type - Default: `'text'`
|
|
99
|
+
- `value` (string): Input value
|
|
100
|
+
- `onChange` (function): Change handler
|
|
101
|
+
- `placeholder` (string): Placeholder text
|
|
102
|
+
- `validate` (boolean): Enable validation - Default: `false`
|
|
103
|
+
- `minLength` (number): Minimum character length
|
|
104
|
+
- `maxLength` (number): Maximum character length
|
|
105
|
+
- `errorMessage` (string): Custom error message
|
|
106
|
+
- `onOtpClick` (function): Callback for OTP button click (when type is 'otp')
|
|
107
|
+
- `className` (string): Additional CSS classes
|
|
108
|
+
- `width` (string): Input width - Default: `'100%'`
|
|
109
|
+
- `height` (string): Input height - Default: `'40px'`
|
|
110
|
+
- `color` (string): Accent color - Default: `'#6B2CE9'`
|
|
111
|
+
- `textColor` (string): Text color - Default: `'white'`
|
|
112
|
+
- `backgroundColor` (string): Background color - Default: `'#1F1F23'`
|
|
113
|
+
- `borderRadius` (string): Border radius - Default: `'10px'`
|
|
114
|
+
|
|
115
|
+
**Example:**
|
|
116
|
+
|
|
117
|
+
```tsx
|
|
118
|
+
<Input
|
|
119
|
+
type="email"
|
|
120
|
+
value={email}
|
|
121
|
+
onChange={(e) => setEmail(e.target.value)}
|
|
122
|
+
placeholder="Enter your email"
|
|
123
|
+
validate={true}
|
|
124
|
+
errorMessage="Please enter a valid email"
|
|
125
|
+
/>
|
|
126
|
+
|
|
127
|
+
<Input
|
|
128
|
+
type="password"
|
|
129
|
+
value={password}
|
|
130
|
+
onChange={(e) => setPassword(e.target.value)}
|
|
131
|
+
minLength={8}
|
|
132
|
+
validate={true}
|
|
133
|
+
/>
|
|
134
|
+
|
|
135
|
+
<Input
|
|
136
|
+
type="otp"
|
|
137
|
+
value={otp}
|
|
138
|
+
onChange={(e) => setOtp(e.target.value)}
|
|
139
|
+
onOtpClick={() => console.log('Send OTP')}
|
|
140
|
+
placeholder="Enter OTP"
|
|
141
|
+
/>
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
### Skeleton
|
|
145
|
+
|
|
146
|
+
A loading placeholder component with multiple variants and animations.
|
|
147
|
+
|
|
148
|
+
**Props:**
|
|
149
|
+
|
|
150
|
+
- `variant` ('text' | 'circular' | 'rectangular'): Skeleton shape - Default: `'rectangular'`
|
|
151
|
+
- `width` (string | number): Width of skeleton - Default: `'100%'`
|
|
152
|
+
- `height` (string | number): Height of skeleton - Default: `'100%'`
|
|
153
|
+
- `animation` ('pulse' | 'wave' | 'none'): Animation type - Default: `'pulse'`
|
|
154
|
+
- `className` (string): Additional CSS classes
|
|
155
|
+
|
|
156
|
+
**Example:**
|
|
157
|
+
|
|
158
|
+
```tsx
|
|
159
|
+
<Skeleton variant="text" width="200px" height="20px" />
|
|
160
|
+
<Skeleton variant="circular" width="50px" height="50px" />
|
|
161
|
+
<Skeleton variant="rectangular" width="100%" height="200px" animation="wave" />
|
|
162
|
+
```
|
|
163
|
+
|
|
65
164
|
## Development
|
|
66
165
|
|
|
67
166
|
```bash
|
package/dist/index.d.mts
CHANGED
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -20,9 +20,9 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
20
20
|
// src/index.ts
|
|
21
21
|
var index_exports = {};
|
|
22
22
|
__export(index_exports, {
|
|
23
|
+
Input: () => Input_default,
|
|
23
24
|
Modal: () => Modal_default,
|
|
24
|
-
Skeleton: () => Skeleton_default
|
|
25
|
-
TextInput: () => Input_default
|
|
25
|
+
Skeleton: () => Skeleton_default
|
|
26
26
|
});
|
|
27
27
|
module.exports = __toCommonJS(index_exports);
|
|
28
28
|
|
|
@@ -347,7 +347,7 @@ var Skeleton = ({
|
|
|
347
347
|
var Skeleton_default = Skeleton;
|
|
348
348
|
// Annotate the CommonJS export names for ESM import in node:
|
|
349
349
|
0 && (module.exports = {
|
|
350
|
+
Input,
|
|
350
351
|
Modal,
|
|
351
|
-
Skeleton
|
|
352
|
-
TextInput
|
|
352
|
+
Skeleton
|
|
353
353
|
});
|
package/dist/index.mjs
CHANGED
package/dist/styles.css
CHANGED