@versini/ui-pill 4.0.8 → 4.0.10
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 +45 -66
- package/dist/index.js +3 -3
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
# @versini/ui-pill
|
|
2
2
|
|
|
3
3
|
[](https://www.npmjs.com/package/@versini/ui-pill)
|
|
4
|
+
>)
|
|
4
5
|
|
|
5
6
|
> A versatile and accessible React pill component built with TypeScript and TailwindCSS.
|
|
6
7
|
|
|
7
8
|
The Pill component provides status indicators, badges, and labels with multiple variants and built-in accessibility features. Perfect for displaying statuses, categories, or other categorical information.
|
|
8
9
|
|
|
9
|
-
|
|
10
10
|
## Table of Contents
|
|
11
11
|
|
|
12
12
|
- [Features](#features)
|
|
@@ -28,7 +28,7 @@ The Pill component provides status indicators, badges, and labels with multiple
|
|
|
28
28
|
npm install @versini/ui-pill
|
|
29
29
|
```
|
|
30
30
|
|
|
31
|
-
> **Note**: This component requires TailwindCSS and the `@versini/ui-styles` plugin for proper styling. See the [
|
|
31
|
+
> **Note**: This component requires TailwindCSS and the `@versini/ui-styles` plugin for proper styling. See the [installation documentation](https://versini-org.github.io/ui-components/?path=/docs/getting-started-installation--docs) for complete setup instructions.
|
|
32
32
|
|
|
33
33
|
## Usage
|
|
34
34
|
|
|
@@ -38,9 +38,7 @@ npm install @versini/ui-pill
|
|
|
38
38
|
import { Pill } from "@versini/ui-pill";
|
|
39
39
|
|
|
40
40
|
function App() {
|
|
41
|
-
return
|
|
42
|
-
<Pill label="Active" />
|
|
43
|
-
);
|
|
41
|
+
return <Pill label="Active" />;
|
|
44
42
|
}
|
|
45
43
|
```
|
|
46
44
|
|
|
@@ -69,21 +67,9 @@ import { Pill } from "@versini/ui-pill";
|
|
|
69
67
|
function App() {
|
|
70
68
|
return (
|
|
71
69
|
<div className="space-x-2">
|
|
72
|
-
<Pill
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
description="User status"
|
|
76
|
-
/>
|
|
77
|
-
<Pill
|
|
78
|
-
label="Pending"
|
|
79
|
-
variant="warning"
|
|
80
|
-
description="Order status"
|
|
81
|
-
/>
|
|
82
|
-
<Pill
|
|
83
|
-
label="Failed"
|
|
84
|
-
variant="error"
|
|
85
|
-
description="Deployment status"
|
|
86
|
-
/>
|
|
70
|
+
<Pill label="Online" variant="success" description="User status" />
|
|
71
|
+
<Pill label="Pending" variant="warning" description="Order status" />
|
|
72
|
+
<Pill label="Failed" variant="error" description="Deployment status" />
|
|
87
73
|
</div>
|
|
88
74
|
);
|
|
89
75
|
}
|
|
@@ -93,12 +79,12 @@ function App() {
|
|
|
93
79
|
|
|
94
80
|
### Pill Props
|
|
95
81
|
|
|
96
|
-
| Prop
|
|
97
|
-
|
|
98
|
-
| label
|
|
99
|
-
| variant
|
|
100
|
-
| description | `string`
|
|
101
|
-
| className
|
|
82
|
+
| Prop | Type | Default | Description |
|
|
83
|
+
| ----------- | ---------------------------------------------------- | --------------- | ------------------------------------------------------- |
|
|
84
|
+
| label | `string` | - | Content of the Pill (required) |
|
|
85
|
+
| variant | `"information" \| "warning" \| "error" \| "success"` | `"information"` | Theme of the Pill |
|
|
86
|
+
| description | `string` | - | Hidden label for screen readers (2-3 words recommended) |
|
|
87
|
+
| className | `string` | - | CSS class(es) to add to the main component wrapper |
|
|
102
88
|
|
|
103
89
|
## Examples
|
|
104
90
|
|
|
@@ -111,15 +97,19 @@ function StatusIndicators() {
|
|
|
111
97
|
const users = [
|
|
112
98
|
{ name: "Alice", status: "online" },
|
|
113
99
|
{ name: "Bob", status: "away" },
|
|
114
|
-
{ name: "Charlie", status: "offline" }
|
|
100
|
+
{ name: "Charlie", status: "offline" }
|
|
115
101
|
];
|
|
116
102
|
|
|
117
103
|
const getStatusVariant = (status: string) => {
|
|
118
104
|
switch (status) {
|
|
119
|
-
case "online":
|
|
120
|
-
|
|
121
|
-
case "
|
|
122
|
-
|
|
105
|
+
case "online":
|
|
106
|
+
return "success";
|
|
107
|
+
case "away":
|
|
108
|
+
return "warning";
|
|
109
|
+
case "offline":
|
|
110
|
+
return "error";
|
|
111
|
+
default:
|
|
112
|
+
return "information";
|
|
123
113
|
}
|
|
124
114
|
};
|
|
125
115
|
|
|
@@ -128,8 +118,8 @@ function StatusIndicators() {
|
|
|
128
118
|
{users.map((user) => (
|
|
129
119
|
<div key={user.name} className="flex items-center space-x-2">
|
|
130
120
|
<span>{user.name}</span>
|
|
131
|
-
<Pill
|
|
132
|
-
label={user.status}
|
|
121
|
+
<Pill
|
|
122
|
+
label={user.status}
|
|
133
123
|
variant={getStatusVariant(user.status)}
|
|
134
124
|
description="User status"
|
|
135
125
|
/>
|
|
@@ -150,17 +140,20 @@ function OrderDashboard() {
|
|
|
150
140
|
{ id: "ORD-001", status: "processing", variant: "information" },
|
|
151
141
|
{ id: "ORD-002", status: "shipped", variant: "success" },
|
|
152
142
|
{ id: "ORD-003", status: "delayed", variant: "warning" },
|
|
153
|
-
{ id: "ORD-004", status: "cancelled", variant: "error" }
|
|
143
|
+
{ id: "ORD-004", status: "cancelled", variant: "error" }
|
|
154
144
|
];
|
|
155
145
|
|
|
156
146
|
return (
|
|
157
147
|
<div className="space-y-3">
|
|
158
148
|
<h3>Recent Orders</h3>
|
|
159
149
|
{orders.map((order) => (
|
|
160
|
-
<div
|
|
150
|
+
<div
|
|
151
|
+
key={order.id}
|
|
152
|
+
className="flex justify-between items-center p-3 border rounded"
|
|
153
|
+
>
|
|
161
154
|
<span className="font-mono">{order.id}</span>
|
|
162
|
-
<Pill
|
|
163
|
-
label={order.status}
|
|
155
|
+
<Pill
|
|
156
|
+
label={order.status}
|
|
164
157
|
variant={order.variant as any}
|
|
165
158
|
description="Order status"
|
|
166
159
|
/>
|
|
@@ -187,9 +180,9 @@ function CategoryTags() {
|
|
|
187
180
|
<h2>{article.title}</h2>
|
|
188
181
|
<div className="flex flex-wrap gap-2">
|
|
189
182
|
{article.categories.map((category) => (
|
|
190
|
-
<Pill
|
|
183
|
+
<Pill
|
|
191
184
|
key={category}
|
|
192
|
-
label={category}
|
|
185
|
+
label={category}
|
|
193
186
|
variant="information"
|
|
194
187
|
description="Article category"
|
|
195
188
|
/>
|
|
@@ -209,27 +202,17 @@ function CustomStyledPills() {
|
|
|
209
202
|
return (
|
|
210
203
|
<div className="space-y-4">
|
|
211
204
|
<div className="space-x-2">
|
|
212
|
-
<Pill
|
|
213
|
-
label="Premium"
|
|
205
|
+
<Pill
|
|
206
|
+
label="Premium"
|
|
214
207
|
variant="success"
|
|
215
208
|
className="font-bold border-2 border-gold-500"
|
|
216
209
|
/>
|
|
217
|
-
<Pill
|
|
218
|
-
label="Beta"
|
|
219
|
-
variant="information"
|
|
220
|
-
className="animate-pulse"
|
|
221
|
-
/>
|
|
210
|
+
<Pill label="Beta" variant="information" className="animate-pulse" />
|
|
222
211
|
</div>
|
|
223
|
-
|
|
212
|
+
|
|
224
213
|
<div className="space-x-2">
|
|
225
|
-
<Pill
|
|
226
|
-
|
|
227
|
-
className="px-4 py-2 text-lg"
|
|
228
|
-
/>
|
|
229
|
-
<Pill
|
|
230
|
-
label="Small"
|
|
231
|
-
className="px-1 py-0.5 text-xs"
|
|
232
|
-
/>
|
|
214
|
+
<Pill label="Large" className="px-4 py-2 text-lg" />
|
|
215
|
+
<Pill label="Small" className="px-1 py-0.5 text-xs" />
|
|
233
216
|
</div>
|
|
234
217
|
</div>
|
|
235
218
|
);
|
|
@@ -245,23 +228,19 @@ function NotificationBadges() {
|
|
|
245
228
|
return (
|
|
246
229
|
<div className="space-y-4">
|
|
247
230
|
<div className="relative inline-block">
|
|
248
|
-
<button className="p-2 bg-gray-200 rounded">
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
<Pill
|
|
252
|
-
label="3"
|
|
231
|
+
<button className="p-2 bg-gray-200 rounded">Messages</button>
|
|
232
|
+
<Pill
|
|
233
|
+
label="3"
|
|
253
234
|
variant="error"
|
|
254
235
|
description="Unread messages"
|
|
255
236
|
className="absolute -top-2 -right-2 min-w-[20px] h-5 text-xs"
|
|
256
237
|
/>
|
|
257
238
|
</div>
|
|
258
|
-
|
|
239
|
+
|
|
259
240
|
<div className="relative inline-block">
|
|
260
|
-
<button className="p-2 bg-gray-200 rounded">
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
<Pill
|
|
264
|
-
label="!"
|
|
241
|
+
<button className="p-2 bg-gray-200 rounded">Notifications</button>
|
|
242
|
+
<Pill
|
|
243
|
+
label="!"
|
|
265
244
|
variant="warning"
|
|
266
245
|
description="New notifications"
|
|
267
246
|
className="absolute -top-1 -right-1 w-4 h-4 text-xs flex items-center justify-center"
|
package/dist/index.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { PILL_CLASSNAME as o, Pill as I } from "./components/Pill/Pill.js";
|
|
2
2
|
/*!
|
|
3
|
-
@versini/ui-pill v4.0.
|
|
3
|
+
@versini/ui-pill v4.0.10
|
|
4
4
|
© 2025 gizmette.com
|
|
5
5
|
*/
|
|
6
6
|
try {
|
|
7
7
|
window.__VERSINI_UI_PILL__ || (window.__VERSINI_UI_PILL__ = {
|
|
8
|
-
version: "4.0.
|
|
9
|
-
buildTime: "08/23/2025
|
|
8
|
+
version: "4.0.10",
|
|
9
|
+
buildTime: "08/23/2025 12:23 PM EDT",
|
|
10
10
|
homepage: "https://github.com/aversini/ui-components",
|
|
11
11
|
license: "MIT"
|
|
12
12
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@versini/ui-pill",
|
|
3
|
-
"version": "4.0.
|
|
3
|
+
"version": "4.0.10",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"author": "Arno Versini",
|
|
6
6
|
"publishConfig": {
|
|
@@ -51,5 +51,5 @@
|
|
|
51
51
|
"sideEffects": [
|
|
52
52
|
"**/*.css"
|
|
53
53
|
],
|
|
54
|
-
"gitHead": "
|
|
54
|
+
"gitHead": "d568e20474c6c87f836c4cb6548f2cc0143a353c"
|
|
55
55
|
}
|