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