@tapizlabs/ui 0.1.6 → 0.2.3
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/CHANGELOG.md +16 -16
- package/LICENSE +21 -21
- package/README.md +358 -358
- package/dist/fonts.css +161 -161
- package/dist/fonts.js.map +1 -1
- package/dist/index.d.ts +881 -30
- package/dist/index.js +1685 -160
- package/dist/index.js.map +1 -1
- package/dist/tailwind-theme.css +113 -113
- package/dist/theme.css +418 -772
- package/package.json +5 -5
- package/FRAMEWORK_BOUNDARY.md +0 -47
package/README.md
CHANGED
|
@@ -1,358 +1,358 @@
|
|
|
1
|
-
# @tapizlabs/ui
|
|
2
|
-
|
|
3
|
-
Shared Tapiz design system package for React applications.
|
|
4
|
-
|
|
5
|
-
Repository: `https://github.com/owlCoder/tapiz-design-system`
|
|
6
|
-
|
|
7
|
-
`@tapizlabs/ui` centralizes the visual foundation used across Tapiz frontends:
|
|
8
|
-
|
|
9
|
-
- shared theme tokens and utility classes
|
|
10
|
-
- shared font loading
|
|
11
|
-
- shared icon exports
|
|
12
|
-
- shared React UI primitives
|
|
13
|
-
|
|
14
|
-
It is intended to keep multiple apps visually aligned while reducing duplicated UI code.
|
|
15
|
-
|
|
16
|
-
## Installation
|
|
17
|
-
|
|
18
|
-
```bash
|
|
19
|
-
npm install @tapizlabs/ui
|
|
20
|
-
```
|
|
21
|
-
|
|
22
|
-
This package expects Tailwind CSS v4 to already exist in the consuming app.
|
|
23
|
-
|
|
24
|
-
If your app does not use Tailwind yet, install it before using `@tapizlabs/ui`:
|
|
25
|
-
|
|
26
|
-
```bash
|
|
27
|
-
npm install tailwindcss @tailwindcss/postcss
|
|
28
|
-
```
|
|
29
|
-
|
|
30
|
-
## Requirements
|
|
31
|
-
|
|
32
|
-
- `react >= 19`
|
|
33
|
-
- `react-dom >= 19`
|
|
34
|
-
- `tailwindcss >= 4`
|
|
35
|
-
|
|
36
|
-
These are declared as peer dependencies and must be provided by the consuming app.
|
|
37
|
-
|
|
38
|
-
Important: `@tapizlabs/ui` is not Tailwind-free. Consumer applications must have Tailwind CSS v4 configured, otherwise shared styles and local utility classes will not build correctly.
|
|
39
|
-
|
|
40
|
-
## Package Exports
|
|
41
|
-
|
|
42
|
-
This package exposes:
|
|
43
|
-
|
|
44
|
-
- `@tapizlabs/ui`
|
|
45
|
-
React components, icons, and exported TypeScript types
|
|
46
|
-
- `@tapizlabs/ui/theme.css`
|
|
47
|
-
Shared theme tokens, utility classes, button styles, surfaces, and animation helpers
|
|
48
|
-
- `@tapizlabs/ui/fonts`
|
|
49
|
-
Shared IBM Plex font loading entrypoint
|
|
50
|
-
|
|
51
|
-
## Quick Start
|
|
52
|
-
|
|
53
|
-
Import fonts once in your application entry:
|
|
54
|
-
|
|
55
|
-
```ts
|
|
56
|
-
import "@tapizlabs/ui/fonts";
|
|
57
|
-
```
|
|
58
|
-
|
|
59
|
-
Import the shared theme before your app-specific styles:
|
|
60
|
-
|
|
61
|
-
```css
|
|
62
|
-
@import "@tapizlabs/ui/theme.css";
|
|
63
|
-
```
|
|
64
|
-
|
|
65
|
-
Then consume components directly from the package:
|
|
66
|
-
|
|
67
|
-
```tsx
|
|
68
|
-
import { Button, EmptyState, InfoBanner } from "@tapizlabs/ui";
|
|
69
|
-
|
|
70
|
-
export function ExamplePanel() {
|
|
71
|
-
return (
|
|
72
|
-
<div className="space-y-4">
|
|
73
|
-
<InfoBanner
|
|
74
|
-
title="Shared UI"
|
|
75
|
-
description="This screen is using the shared Tapiz design system package."
|
|
76
|
-
/>
|
|
77
|
-
<Button>Save changes</Button>
|
|
78
|
-
<EmptyState
|
|
79
|
-
title="No records"
|
|
80
|
-
description="Create your first item to get started."
|
|
81
|
-
/>
|
|
82
|
-
</div>
|
|
83
|
-
);
|
|
84
|
-
}
|
|
85
|
-
```
|
|
86
|
-
|
|
87
|
-
## Tailwind Setup
|
|
88
|
-
|
|
89
|
-
`@tapizlabs/ui/theme.css` is published as a compiled CSS bundle, so consumer apps only need to import it. No extra `@source` directive is required in application code.
|
|
90
|
-
|
|
91
|
-
You still must keep Tailwind enabled in the consuming app itself.
|
|
92
|
-
|
|
93
|
-
Minimum consumer setup:
|
|
94
|
-
|
|
95
|
-
```js
|
|
96
|
-
// postcss.config.js
|
|
97
|
-
export default {
|
|
98
|
-
plugins: {
|
|
99
|
-
"@tailwindcss/postcss": {},
|
|
100
|
-
},
|
|
101
|
-
};
|
|
102
|
-
```
|
|
103
|
-
|
|
104
|
-
```css
|
|
105
|
-
/* app entry CSS */
|
|
106
|
-
@import "@tapizlabs/ui/theme.css";
|
|
107
|
-
@import "tailwindcss";
|
|
108
|
-
@source "./**/*.{ts,tsx}";
|
|
109
|
-
```
|
|
110
|
-
|
|
111
|
-
If Tailwind is missing from the consumer app, `@tapizlabs/ui` will not render correctly.
|
|
112
|
-
|
|
113
|
-
## Included Components
|
|
114
|
-
|
|
115
|
-
Current exports include:
|
|
116
|
-
|
|
117
|
-
- `Button`
|
|
118
|
-
- `Input`
|
|
119
|
-
- `Select`
|
|
120
|
-
- `Textarea`
|
|
121
|
-
- `FieldLabel`
|
|
122
|
-
- `FieldHint`
|
|
123
|
-
- `Checkbox`
|
|
124
|
-
- `RadioButton`
|
|
125
|
-
- `Spinner`
|
|
126
|
-
- `PageSpinner`
|
|
127
|
-
- `Toast`
|
|
128
|
-
- `ToastProvider`
|
|
129
|
-
- `useToast`
|
|
130
|
-
- `FormError`
|
|
131
|
-
- `ErrorBoundary`
|
|
132
|
-
- `BaseModal`
|
|
133
|
-
- `ConfirmDialog`
|
|
134
|
-
- `Tooltip`
|
|
135
|
-
- `Badge`
|
|
136
|
-
- `Card`
|
|
137
|
-
- `CardHeader`
|
|
138
|
-
- `CardBody`
|
|
139
|
-
- `EmptyState`
|
|
140
|
-
- `ErrorState`
|
|
141
|
-
- `InfoBanner`
|
|
142
|
-
- `PageHeader`
|
|
143
|
-
- `SearchInput`
|
|
144
|
-
- `Pagination`
|
|
145
|
-
- `SectionTitle`
|
|
146
|
-
- `StatusBadge`
|
|
147
|
-
- `ActionMenu`
|
|
148
|
-
- `Skeleton`
|
|
149
|
-
- `SkeletonCard`
|
|
150
|
-
- `SkeletonKpiCard`
|
|
151
|
-
- `SkeletonBanner`
|
|
152
|
-
- `SkeletonPageHeader`
|
|
153
|
-
- `SkeletonTable`
|
|
154
|
-
- `DataTable`
|
|
155
|
-
|
|
156
|
-
## Component Examples
|
|
157
|
-
|
|
158
|
-
### Button
|
|
159
|
-
|
|
160
|
-
```tsx
|
|
161
|
-
import { Button, Plus } from "@tapizlabs/ui";
|
|
162
|
-
|
|
163
|
-
export function Actions() {
|
|
164
|
-
return (
|
|
165
|
-
<div className="flex gap-3">
|
|
166
|
-
<Button>Default</Button>
|
|
167
|
-
<Button variant="secondary" icon={Plus}>
|
|
168
|
-
Create
|
|
169
|
-
</Button>
|
|
170
|
-
<Button variant="danger" loading>
|
|
171
|
-
Deleting
|
|
172
|
-
</Button>
|
|
173
|
-
</div>
|
|
174
|
-
);
|
|
175
|
-
}
|
|
176
|
-
```
|
|
177
|
-
|
|
178
|
-
### ConfirmDialog
|
|
179
|
-
|
|
180
|
-
```tsx
|
|
181
|
-
import { ConfirmDialog, Trash } from "@tapizlabs/ui";
|
|
182
|
-
|
|
183
|
-
export function DeleteDialogExample() {
|
|
184
|
-
return (
|
|
185
|
-
<ConfirmDialog
|
|
186
|
-
open
|
|
187
|
-
danger
|
|
188
|
-
title="Delete record"
|
|
189
|
-
description="This action cannot be undone."
|
|
190
|
-
icon={<Trash size={14} />}
|
|
191
|
-
confirmLabel="Delete"
|
|
192
|
-
cancelLabel="Cancel"
|
|
193
|
-
onConfirm={() => {}}
|
|
194
|
-
onCancel={() => {}}
|
|
195
|
-
/>
|
|
196
|
-
);
|
|
197
|
-
}
|
|
198
|
-
```
|
|
199
|
-
|
|
200
|
-
Compatibility note:
|
|
201
|
-
|
|
202
|
-
- `ConfirmDialog` supports both `description` and legacy `message`
|
|
203
|
-
|
|
204
|
-
### Form Primitives
|
|
205
|
-
|
|
206
|
-
```tsx
|
|
207
|
-
import { FieldHint, FieldLabel, Input, Select, Textarea } from "@tapizlabs/ui";
|
|
208
|
-
|
|
209
|
-
export function ProfileFields() {
|
|
210
|
-
return (
|
|
211
|
-
<div className="space-y-4">
|
|
212
|
-
<div className="space-y-2">
|
|
213
|
-
<FieldLabel htmlFor="name">Display name</FieldLabel>
|
|
214
|
-
<Input id="name" placeholder="Jane Doe" />
|
|
215
|
-
<FieldHint>Visible to other Tapiz users.</FieldHint>
|
|
216
|
-
</div>
|
|
217
|
-
|
|
218
|
-
<div className="space-y-2">
|
|
219
|
-
<FieldLabel htmlFor="role">Role</FieldLabel>
|
|
220
|
-
<Select id="role" defaultValue="assistant">
|
|
221
|
-
<option value="assistant">Assistant</option>
|
|
222
|
-
<option value="student">Student</option>
|
|
223
|
-
</Select>
|
|
224
|
-
</div>
|
|
225
|
-
|
|
226
|
-
<div className="space-y-2">
|
|
227
|
-
<FieldLabel htmlFor="bio">Bio</FieldLabel>
|
|
228
|
-
<Textarea id="bio" rows={4} placeholder="Short description" />
|
|
229
|
-
</div>
|
|
230
|
-
</div>
|
|
231
|
-
);
|
|
232
|
-
}
|
|
233
|
-
```
|
|
234
|
-
|
|
235
|
-
### EmptyState
|
|
236
|
-
|
|
237
|
-
```tsx
|
|
238
|
-
import { EmptyState, Info } from "@tapizlabs/ui";
|
|
239
|
-
|
|
240
|
-
export function NoResults() {
|
|
241
|
-
return (
|
|
242
|
-
<EmptyState
|
|
243
|
-
title="No results"
|
|
244
|
-
description="Try adjusting your filters."
|
|
245
|
-
icon={<Info size={18} />}
|
|
246
|
-
/>
|
|
247
|
-
);
|
|
248
|
-
}
|
|
249
|
-
```
|
|
250
|
-
|
|
251
|
-
### ToastProvider
|
|
252
|
-
|
|
253
|
-
```tsx
|
|
254
|
-
import { ToastProvider, useToast } from "@tapizlabs/ui";
|
|
255
|
-
|
|
256
|
-
function SaveButton() {
|
|
257
|
-
const { showToast } = useToast();
|
|
258
|
-
|
|
259
|
-
return (
|
|
260
|
-
<button
|
|
261
|
-
type="button"
|
|
262
|
-
onClick={() => showToast({ message: "Saved successfully.", ok: true })}
|
|
263
|
-
>
|
|
264
|
-
Save
|
|
265
|
-
</button>
|
|
266
|
-
);
|
|
267
|
-
}
|
|
268
|
-
|
|
269
|
-
export function App() {
|
|
270
|
-
return (
|
|
271
|
-
<>
|
|
272
|
-
<SaveButton />
|
|
273
|
-
<ToastProvider />
|
|
274
|
-
</>
|
|
275
|
-
);
|
|
276
|
-
}
|
|
277
|
-
```
|
|
278
|
-
|
|
279
|
-
### DataTable
|
|
280
|
-
|
|
281
|
-
```tsx
|
|
282
|
-
import { DataTable, type Column } from "@tapizlabs/ui";
|
|
283
|
-
|
|
284
|
-
interface User {
|
|
285
|
-
id: string;
|
|
286
|
-
name: string;
|
|
287
|
-
role: string;
|
|
288
|
-
}
|
|
289
|
-
|
|
290
|
-
const columns: Column<User>[] = [
|
|
291
|
-
{ id: "name", header: "Name", cell: (row) => row.name, sortable: true, sortAccessor: (row) => row.name },
|
|
292
|
-
{ id: "role", header: "Role", cell: (row) => row.role },
|
|
293
|
-
];
|
|
294
|
-
|
|
295
|
-
export function UsersTable({ rows }: { rows: User[] }) {
|
|
296
|
-
return (
|
|
297
|
-
<DataTable
|
|
298
|
-
data={rows}
|
|
299
|
-
columns={columns}
|
|
300
|
-
rowKey={(row) => row.id}
|
|
301
|
-
emptyState="No users"
|
|
302
|
-
/>
|
|
303
|
-
);
|
|
304
|
-
}
|
|
305
|
-
```
|
|
306
|
-
|
|
307
|
-
## Included Icon Sets
|
|
308
|
-
|
|
309
|
-
The root package export also includes shared icons used across Tapiz apps, including navigation, status, auth, action, feedback, form, layout, and logo icons.
|
|
310
|
-
|
|
311
|
-
Example:
|
|
312
|
-
|
|
313
|
-
```tsx
|
|
314
|
-
import { Button, Plus, LogoMark } from "@tapizlabs/ui";
|
|
315
|
-
|
|
316
|
-
export function Toolbar() {
|
|
317
|
-
return (
|
|
318
|
-
<div className="flex items-center gap-3">
|
|
319
|
-
<LogoMark />
|
|
320
|
-
<Button icon={Plus}>Create</Button>
|
|
321
|
-
</div>
|
|
322
|
-
);
|
|
323
|
-
}
|
|
324
|
-
```
|
|
325
|
-
|
|
326
|
-
`Button` accepts either a rendered React node or an icon component reference through the `icon` and `iconRight` props.
|
|
327
|
-
|
|
328
|
-
Additional branded/storefront icons such as `AppleIcon`, `GooglePlayIcon`, and `Star` are also exported when needed by marketing surfaces.
|
|
329
|
-
|
|
330
|
-
## Styling Contract
|
|
331
|
-
|
|
332
|
-
This package is intentionally opinionated. It provides the shared Tapiz visual language, including:
|
|
333
|
-
|
|
334
|
-
- theme color variables
|
|
335
|
-
- font variables
|
|
336
|
-
- reusable button classes
|
|
337
|
-
- surface and border tokens
|
|
338
|
-
- shared motion helpers
|
|
339
|
-
|
|
340
|
-
Consumer apps can add local styles on top, but should treat `theme.css` as the base design contract for consistency.
|
|
341
|
-
|
|
342
|
-
## Framework Boundary
|
|
343
|
-
|
|
344
|
-
`@tapizlabs/ui` is the shared framework layer for reusable Tapiz UI primitives. Layout shells, SEO helpers, language/session flows, and domain-bound selectors should usually stay in consuming apps.
|
|
345
|
-
|
|
346
|
-
See [FRAMEWORK_BOUNDARY.md](./FRAMEWORK_BOUNDARY.md) for the exact package-vs-app contract used in this workspace.
|
|
347
|
-
|
|
348
|
-
## Accessibility Notes
|
|
349
|
-
|
|
350
|
-
- modal components render through portals
|
|
351
|
-
- table components expose sortable state through appropriate semantics
|
|
352
|
-
- button and feedback primitives preserve native HTML behavior where possible
|
|
353
|
-
|
|
354
|
-
## License
|
|
355
|
-
|
|
356
|
-
This package is released under the `MIT` license.
|
|
357
|
-
|
|
358
|
-
Attribution is retained as `Tapiz UI` in the package metadata and license file.
|
|
1
|
+
# @tapizlabs/ui
|
|
2
|
+
|
|
3
|
+
Shared Tapiz design system package for React applications.
|
|
4
|
+
|
|
5
|
+
Repository: `https://github.com/owlCoder/tapiz-design-system`
|
|
6
|
+
|
|
7
|
+
`@tapizlabs/ui` centralizes the visual foundation used across Tapiz frontends:
|
|
8
|
+
|
|
9
|
+
- shared theme tokens and utility classes
|
|
10
|
+
- shared font loading
|
|
11
|
+
- shared icon exports
|
|
12
|
+
- shared React UI primitives
|
|
13
|
+
|
|
14
|
+
It is intended to keep multiple apps visually aligned while reducing duplicated UI code.
|
|
15
|
+
|
|
16
|
+
## Installation
|
|
17
|
+
|
|
18
|
+
```bash
|
|
19
|
+
npm install @tapizlabs/ui
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
This package expects Tailwind CSS v4 to already exist in the consuming app.
|
|
23
|
+
|
|
24
|
+
If your app does not use Tailwind yet, install it before using `@tapizlabs/ui`:
|
|
25
|
+
|
|
26
|
+
```bash
|
|
27
|
+
npm install tailwindcss @tailwindcss/postcss
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
## Requirements
|
|
31
|
+
|
|
32
|
+
- `react >= 19`
|
|
33
|
+
- `react-dom >= 19`
|
|
34
|
+
- `tailwindcss >= 4`
|
|
35
|
+
|
|
36
|
+
These are declared as peer dependencies and must be provided by the consuming app.
|
|
37
|
+
|
|
38
|
+
Important: `@tapizlabs/ui` is not Tailwind-free. Consumer applications must have Tailwind CSS v4 configured, otherwise shared styles and local utility classes will not build correctly.
|
|
39
|
+
|
|
40
|
+
## Package Exports
|
|
41
|
+
|
|
42
|
+
This package exposes:
|
|
43
|
+
|
|
44
|
+
- `@tapizlabs/ui`
|
|
45
|
+
React components, icons, and exported TypeScript types
|
|
46
|
+
- `@tapizlabs/ui/theme.css`
|
|
47
|
+
Shared theme tokens, utility classes, button styles, surfaces, and animation helpers
|
|
48
|
+
- `@tapizlabs/ui/fonts`
|
|
49
|
+
Shared IBM Plex font loading entrypoint
|
|
50
|
+
|
|
51
|
+
## Quick Start
|
|
52
|
+
|
|
53
|
+
Import fonts once in your application entry:
|
|
54
|
+
|
|
55
|
+
```ts
|
|
56
|
+
import "@tapizlabs/ui/fonts";
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
Import the shared theme before your app-specific styles:
|
|
60
|
+
|
|
61
|
+
```css
|
|
62
|
+
@import "@tapizlabs/ui/theme.css";
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
Then consume components directly from the package:
|
|
66
|
+
|
|
67
|
+
```tsx
|
|
68
|
+
import { Button, EmptyState, InfoBanner } from "@tapizlabs/ui";
|
|
69
|
+
|
|
70
|
+
export function ExamplePanel() {
|
|
71
|
+
return (
|
|
72
|
+
<div className="space-y-4">
|
|
73
|
+
<InfoBanner
|
|
74
|
+
title="Shared UI"
|
|
75
|
+
description="This screen is using the shared Tapiz design system package."
|
|
76
|
+
/>
|
|
77
|
+
<Button>Save changes</Button>
|
|
78
|
+
<EmptyState
|
|
79
|
+
title="No records"
|
|
80
|
+
description="Create your first item to get started."
|
|
81
|
+
/>
|
|
82
|
+
</div>
|
|
83
|
+
);
|
|
84
|
+
}
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
## Tailwind Setup
|
|
88
|
+
|
|
89
|
+
`@tapizlabs/ui/theme.css` is published as a compiled CSS bundle, so consumer apps only need to import it. No extra `@source` directive is required in application code.
|
|
90
|
+
|
|
91
|
+
You still must keep Tailwind enabled in the consuming app itself.
|
|
92
|
+
|
|
93
|
+
Minimum consumer setup:
|
|
94
|
+
|
|
95
|
+
```js
|
|
96
|
+
// postcss.config.js
|
|
97
|
+
export default {
|
|
98
|
+
plugins: {
|
|
99
|
+
"@tailwindcss/postcss": {},
|
|
100
|
+
},
|
|
101
|
+
};
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
```css
|
|
105
|
+
/* app entry CSS */
|
|
106
|
+
@import "@tapizlabs/ui/theme.css";
|
|
107
|
+
@import "tailwindcss";
|
|
108
|
+
@source "./**/*.{ts,tsx}";
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
If Tailwind is missing from the consumer app, `@tapizlabs/ui` will not render correctly.
|
|
112
|
+
|
|
113
|
+
## Included Components
|
|
114
|
+
|
|
115
|
+
Current exports include:
|
|
116
|
+
|
|
117
|
+
- `Button`
|
|
118
|
+
- `Input`
|
|
119
|
+
- `Select`
|
|
120
|
+
- `Textarea`
|
|
121
|
+
- `FieldLabel`
|
|
122
|
+
- `FieldHint`
|
|
123
|
+
- `Checkbox`
|
|
124
|
+
- `RadioButton`
|
|
125
|
+
- `Spinner`
|
|
126
|
+
- `PageSpinner`
|
|
127
|
+
- `Toast`
|
|
128
|
+
- `ToastProvider`
|
|
129
|
+
- `useToast`
|
|
130
|
+
- `FormError`
|
|
131
|
+
- `ErrorBoundary`
|
|
132
|
+
- `BaseModal`
|
|
133
|
+
- `ConfirmDialog`
|
|
134
|
+
- `Tooltip`
|
|
135
|
+
- `Badge`
|
|
136
|
+
- `Card`
|
|
137
|
+
- `CardHeader`
|
|
138
|
+
- `CardBody`
|
|
139
|
+
- `EmptyState`
|
|
140
|
+
- `ErrorState`
|
|
141
|
+
- `InfoBanner`
|
|
142
|
+
- `PageHeader`
|
|
143
|
+
- `SearchInput`
|
|
144
|
+
- `Pagination`
|
|
145
|
+
- `SectionTitle`
|
|
146
|
+
- `StatusBadge`
|
|
147
|
+
- `ActionMenu`
|
|
148
|
+
- `Skeleton`
|
|
149
|
+
- `SkeletonCard`
|
|
150
|
+
- `SkeletonKpiCard`
|
|
151
|
+
- `SkeletonBanner`
|
|
152
|
+
- `SkeletonPageHeader`
|
|
153
|
+
- `SkeletonTable`
|
|
154
|
+
- `DataTable`
|
|
155
|
+
|
|
156
|
+
## Component Examples
|
|
157
|
+
|
|
158
|
+
### Button
|
|
159
|
+
|
|
160
|
+
```tsx
|
|
161
|
+
import { Button, Plus } from "@tapizlabs/ui";
|
|
162
|
+
|
|
163
|
+
export function Actions() {
|
|
164
|
+
return (
|
|
165
|
+
<div className="flex gap-3">
|
|
166
|
+
<Button>Default</Button>
|
|
167
|
+
<Button variant="secondary" icon={Plus}>
|
|
168
|
+
Create
|
|
169
|
+
</Button>
|
|
170
|
+
<Button variant="danger" loading>
|
|
171
|
+
Deleting
|
|
172
|
+
</Button>
|
|
173
|
+
</div>
|
|
174
|
+
);
|
|
175
|
+
}
|
|
176
|
+
```
|
|
177
|
+
|
|
178
|
+
### ConfirmDialog
|
|
179
|
+
|
|
180
|
+
```tsx
|
|
181
|
+
import { ConfirmDialog, Trash } from "@tapizlabs/ui";
|
|
182
|
+
|
|
183
|
+
export function DeleteDialogExample() {
|
|
184
|
+
return (
|
|
185
|
+
<ConfirmDialog
|
|
186
|
+
open
|
|
187
|
+
danger
|
|
188
|
+
title="Delete record"
|
|
189
|
+
description="This action cannot be undone."
|
|
190
|
+
icon={<Trash size={14} />}
|
|
191
|
+
confirmLabel="Delete"
|
|
192
|
+
cancelLabel="Cancel"
|
|
193
|
+
onConfirm={() => {}}
|
|
194
|
+
onCancel={() => {}}
|
|
195
|
+
/>
|
|
196
|
+
);
|
|
197
|
+
}
|
|
198
|
+
```
|
|
199
|
+
|
|
200
|
+
Compatibility note:
|
|
201
|
+
|
|
202
|
+
- `ConfirmDialog` supports both `description` and legacy `message`
|
|
203
|
+
|
|
204
|
+
### Form Primitives
|
|
205
|
+
|
|
206
|
+
```tsx
|
|
207
|
+
import { FieldHint, FieldLabel, Input, Select, Textarea } from "@tapizlabs/ui";
|
|
208
|
+
|
|
209
|
+
export function ProfileFields() {
|
|
210
|
+
return (
|
|
211
|
+
<div className="space-y-4">
|
|
212
|
+
<div className="space-y-2">
|
|
213
|
+
<FieldLabel htmlFor="name">Display name</FieldLabel>
|
|
214
|
+
<Input id="name" placeholder="Jane Doe" />
|
|
215
|
+
<FieldHint>Visible to other Tapiz users.</FieldHint>
|
|
216
|
+
</div>
|
|
217
|
+
|
|
218
|
+
<div className="space-y-2">
|
|
219
|
+
<FieldLabel htmlFor="role">Role</FieldLabel>
|
|
220
|
+
<Select id="role" defaultValue="assistant">
|
|
221
|
+
<option value="assistant">Assistant</option>
|
|
222
|
+
<option value="student">Student</option>
|
|
223
|
+
</Select>
|
|
224
|
+
</div>
|
|
225
|
+
|
|
226
|
+
<div className="space-y-2">
|
|
227
|
+
<FieldLabel htmlFor="bio">Bio</FieldLabel>
|
|
228
|
+
<Textarea id="bio" rows={4} placeholder="Short description" />
|
|
229
|
+
</div>
|
|
230
|
+
</div>
|
|
231
|
+
);
|
|
232
|
+
}
|
|
233
|
+
```
|
|
234
|
+
|
|
235
|
+
### EmptyState
|
|
236
|
+
|
|
237
|
+
```tsx
|
|
238
|
+
import { EmptyState, Info } from "@tapizlabs/ui";
|
|
239
|
+
|
|
240
|
+
export function NoResults() {
|
|
241
|
+
return (
|
|
242
|
+
<EmptyState
|
|
243
|
+
title="No results"
|
|
244
|
+
description="Try adjusting your filters."
|
|
245
|
+
icon={<Info size={18} />}
|
|
246
|
+
/>
|
|
247
|
+
);
|
|
248
|
+
}
|
|
249
|
+
```
|
|
250
|
+
|
|
251
|
+
### ToastProvider
|
|
252
|
+
|
|
253
|
+
```tsx
|
|
254
|
+
import { ToastProvider, useToast } from "@tapizlabs/ui";
|
|
255
|
+
|
|
256
|
+
function SaveButton() {
|
|
257
|
+
const { showToast } = useToast();
|
|
258
|
+
|
|
259
|
+
return (
|
|
260
|
+
<button
|
|
261
|
+
type="button"
|
|
262
|
+
onClick={() => showToast({ message: "Saved successfully.", ok: true })}
|
|
263
|
+
>
|
|
264
|
+
Save
|
|
265
|
+
</button>
|
|
266
|
+
);
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
export function App() {
|
|
270
|
+
return (
|
|
271
|
+
<>
|
|
272
|
+
<SaveButton />
|
|
273
|
+
<ToastProvider />
|
|
274
|
+
</>
|
|
275
|
+
);
|
|
276
|
+
}
|
|
277
|
+
```
|
|
278
|
+
|
|
279
|
+
### DataTable
|
|
280
|
+
|
|
281
|
+
```tsx
|
|
282
|
+
import { DataTable, type Column } from "@tapizlabs/ui";
|
|
283
|
+
|
|
284
|
+
interface User {
|
|
285
|
+
id: string;
|
|
286
|
+
name: string;
|
|
287
|
+
role: string;
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
const columns: Column<User>[] = [
|
|
291
|
+
{ id: "name", header: "Name", cell: (row) => row.name, sortable: true, sortAccessor: (row) => row.name },
|
|
292
|
+
{ id: "role", header: "Role", cell: (row) => row.role },
|
|
293
|
+
];
|
|
294
|
+
|
|
295
|
+
export function UsersTable({ rows }: { rows: User[] }) {
|
|
296
|
+
return (
|
|
297
|
+
<DataTable
|
|
298
|
+
data={rows}
|
|
299
|
+
columns={columns}
|
|
300
|
+
rowKey={(row) => row.id}
|
|
301
|
+
emptyState="No users"
|
|
302
|
+
/>
|
|
303
|
+
);
|
|
304
|
+
}
|
|
305
|
+
```
|
|
306
|
+
|
|
307
|
+
## Included Icon Sets
|
|
308
|
+
|
|
309
|
+
The root package export also includes shared icons used across Tapiz apps, including navigation, status, auth, action, feedback, form, layout, and logo icons.
|
|
310
|
+
|
|
311
|
+
Example:
|
|
312
|
+
|
|
313
|
+
```tsx
|
|
314
|
+
import { Button, Plus, LogoMark } from "@tapizlabs/ui";
|
|
315
|
+
|
|
316
|
+
export function Toolbar() {
|
|
317
|
+
return (
|
|
318
|
+
<div className="flex items-center gap-3">
|
|
319
|
+
<LogoMark />
|
|
320
|
+
<Button icon={Plus}>Create</Button>
|
|
321
|
+
</div>
|
|
322
|
+
);
|
|
323
|
+
}
|
|
324
|
+
```
|
|
325
|
+
|
|
326
|
+
`Button` accepts either a rendered React node or an icon component reference through the `icon` and `iconRight` props.
|
|
327
|
+
|
|
328
|
+
Additional branded/storefront icons such as `AppleIcon`, `GooglePlayIcon`, and `Star` are also exported when needed by marketing surfaces.
|
|
329
|
+
|
|
330
|
+
## Styling Contract
|
|
331
|
+
|
|
332
|
+
This package is intentionally opinionated. It provides the shared Tapiz visual language, including:
|
|
333
|
+
|
|
334
|
+
- theme color variables
|
|
335
|
+
- font variables
|
|
336
|
+
- reusable button classes
|
|
337
|
+
- surface and border tokens
|
|
338
|
+
- shared motion helpers
|
|
339
|
+
|
|
340
|
+
Consumer apps can add local styles on top, but should treat `theme.css` as the base design contract for consistency.
|
|
341
|
+
|
|
342
|
+
## Framework Boundary
|
|
343
|
+
|
|
344
|
+
`@tapizlabs/ui` is the shared framework layer for reusable Tapiz UI primitives. Layout shells, SEO helpers, language/session flows, and domain-bound selectors should usually stay in consuming apps.
|
|
345
|
+
|
|
346
|
+
See [FRAMEWORK_BOUNDARY.md](./FRAMEWORK_BOUNDARY.md) for the exact package-vs-app contract used in this workspace.
|
|
347
|
+
|
|
348
|
+
## Accessibility Notes
|
|
349
|
+
|
|
350
|
+
- modal components render through portals
|
|
351
|
+
- table components expose sortable state through appropriate semantics
|
|
352
|
+
- button and feedback primitives preserve native HTML behavior where possible
|
|
353
|
+
|
|
354
|
+
## License
|
|
355
|
+
|
|
356
|
+
This package is released under the `MIT` license.
|
|
357
|
+
|
|
358
|
+
Attribution is retained as `Tapiz UI` in the package metadata and license file.
|