@tanishraj/ui-kit 1.1.0 → 2.0.1
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/dist/colors/base.css +292 -0
- package/dist/globals.css +1 -2
- package/dist/index.cjs.js +2 -1
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.d.ts +145 -1
- package/dist/index.es.js +32 -12
- package/dist/index.es.js.map +1 -1
- package/package.json +6 -6
- package/readme.md +99 -26
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tanishraj/ui-kit",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.1",
|
|
4
4
|
"description": "A production-ready React component library with modern tooling, Storybook docs, and TypeScript support.",
|
|
5
5
|
"author": "Tanishraj",
|
|
6
6
|
"license": "MIT",
|
|
@@ -27,10 +27,10 @@
|
|
|
27
27
|
"require": "./dist/globals.css",
|
|
28
28
|
"default": "./dist/globals.css"
|
|
29
29
|
},
|
|
30
|
-
"./
|
|
31
|
-
"import": "./dist/
|
|
32
|
-
"require": "./dist/
|
|
33
|
-
"default": "./dist/
|
|
30
|
+
"./base.css": {
|
|
31
|
+
"import": "./dist/colors/base.css",
|
|
32
|
+
"require": "./dist/colors/base.css",
|
|
33
|
+
"default": "./dist/colors/base.css"
|
|
34
34
|
},
|
|
35
35
|
"./theme-secondary.css": {
|
|
36
36
|
"import": "./dist/themes/secondary.css",
|
|
@@ -51,7 +51,7 @@
|
|
|
51
51
|
],
|
|
52
52
|
"scripts": {
|
|
53
53
|
"build": "rm -rf dist && vite build && npm run copy:theme && rm -rf dist/src",
|
|
54
|
-
"copy:theme": "mkdir -p dist/themes && cp src/themes/primary.css dist/themes/primary.css && cp src/themes/secondary.css dist/themes/secondary.css &&
|
|
54
|
+
"copy:theme": "mkdir -p dist/themes dist/colors && cp src/themes/primary.css dist/themes/primary.css && cp src/themes/secondary.css dist/themes/secondary.css && perl -pe \"s#(\\@import '../themes/primary\\.css';)#\\@import './themes/primary.css';#\" src/styles/globals.css > dist/globals.css && cp src/styles/colors/base.css dist/colors/base.css",
|
|
55
55
|
"prepublishOnly": "npm run build",
|
|
56
56
|
"test": "vitest",
|
|
57
57
|
"test:watch": "vitest --watch",
|
package/readme.md
CHANGED
|
@@ -61,12 +61,15 @@ import {
|
|
|
61
61
|
Badge,
|
|
62
62
|
Avatar,
|
|
63
63
|
AvatarGroup,
|
|
64
|
+
Breadcrumb,
|
|
65
|
+
Checkbox,
|
|
66
|
+
CheckboxGroup,
|
|
67
|
+
Chip,
|
|
68
|
+
Divider,
|
|
64
69
|
} from '@tanishraj/ui-kit';
|
|
65
|
-
import '@tanishraj/ui-kit/globals.css';
|
|
66
|
-
import '@tanishraj/ui-kit/theme-primary.css';
|
|
67
70
|
|
|
68
71
|
export function Demo() {
|
|
69
|
-
return <Button variant=
|
|
72
|
+
return <Button variant='primary'>Get Started</Button>;
|
|
70
73
|
}
|
|
71
74
|
```
|
|
72
75
|
|
|
@@ -80,25 +83,25 @@ The library is built to be consumed like a standard React UI package:
|
|
|
80
83
|
npm install @tanishraj/ui-kit
|
|
81
84
|
```
|
|
82
85
|
|
|
83
|
-
2.
|
|
86
|
+
2. Use components (styles are included automatically on package import):
|
|
84
87
|
|
|
85
|
-
|
|
86
|
-
import '@tanishraj/ui-kit/globals.css';
|
|
87
|
-
import '@tanishraj/ui-kit/theme-primary.css'; // or theme-secondary.css
|
|
88
|
-
```
|
|
89
|
-
|
|
90
|
-
3. Use component APIs directly from the package.
|
|
88
|
+
Use component APIs directly from the package.
|
|
91
89
|
|
|
92
90
|
```tsx
|
|
93
|
-
import { Button,
|
|
91
|
+
import { Avatar, Button, Chip, Divider } from '@tanishraj/ui-kit';
|
|
92
|
+
import { Plus } from 'lucide-react';
|
|
94
93
|
|
|
95
94
|
export default function Demo() {
|
|
96
95
|
return (
|
|
97
|
-
<div className=
|
|
98
|
-
<Button variant=
|
|
96
|
+
<div className='flex items-center gap-4'>
|
|
97
|
+
<Button variant='primary' size='md'>
|
|
99
98
|
Primary Button
|
|
100
99
|
</Button>
|
|
101
|
-
<Avatar initials=
|
|
100
|
+
<Avatar initials='AB' variant='primary' />
|
|
101
|
+
<Chip icon={Plus} variant='success'>
|
|
102
|
+
Active
|
|
103
|
+
</Chip>
|
|
104
|
+
<Divider className='w-32' />
|
|
102
105
|
</div>
|
|
103
106
|
);
|
|
104
107
|
}
|
|
@@ -107,15 +110,23 @@ export default function Demo() {
|
|
|
107
110
|
### Theme file options
|
|
108
111
|
|
|
109
112
|
```ts
|
|
110
|
-
import
|
|
111
|
-
// Optional: use another packaged theme
|
|
113
|
+
// Optional: import this only when you want secondary theme
|
|
112
114
|
import '@tanishraj/ui-kit/theme-secondary.css';
|
|
113
115
|
```
|
|
114
116
|
|
|
117
|
+
### Adding new themes (for maintainers)
|
|
118
|
+
|
|
119
|
+
To add a new packaged theme later:
|
|
120
|
+
|
|
121
|
+
1. Add `src/themes/<theme-name>.css`.
|
|
122
|
+
2. Add a package export in `package.json`:
|
|
123
|
+
- `./theme-<theme-name>.css` -> `./dist/themes/<theme-name>.css`
|
|
124
|
+
3. Update the `copy:theme` script to include the new file.
|
|
125
|
+
4. Optionally publish a themed import via `./themes/<theme-name>.css` (already supported by the wildcard export pattern).
|
|
126
|
+
|
|
115
127
|
You can also import through:
|
|
116
128
|
|
|
117
129
|
```ts
|
|
118
|
-
import '@tanishraj/ui-kit/themes/primary.css';
|
|
119
130
|
import '@tanishraj/ui-kit/themes/secondary.css';
|
|
120
131
|
```
|
|
121
132
|
|
|
@@ -127,10 +138,67 @@ If your app uses a custom design token strategy, import one packaged theme and o
|
|
|
127
138
|
- Props follow consistent naming patterns:
|
|
128
139
|
- `size` (`sm`, `md`, `lg`)
|
|
129
140
|
- `variant` (status/visual intent)
|
|
141
|
+
- `appearance` (container treatment such as `filled`, `outline`, `ghost`, or `dashed`, depending on component)
|
|
130
142
|
- `shape` (`circle`, `square` where supported)
|
|
143
|
+
- `inverted` for alternate surface color modes where supported
|
|
131
144
|
- `disabled`, `loading`, and interaction states where applicable
|
|
132
145
|
- Component stories in `*.stories.tsx` are the source of truth for public usage patterns and prop combinations.
|
|
133
146
|
|
|
147
|
+
### Common Examples
|
|
148
|
+
|
|
149
|
+
```tsx
|
|
150
|
+
import {
|
|
151
|
+
Breadcrumb,
|
|
152
|
+
Button,
|
|
153
|
+
CheckboxGroup,
|
|
154
|
+
Chip,
|
|
155
|
+
Divider,
|
|
156
|
+
} from '@tanishraj/ui-kit';
|
|
157
|
+
import { Home, Plus, Tag } from 'lucide-react';
|
|
158
|
+
|
|
159
|
+
export function ComponentExamples() {
|
|
160
|
+
return (
|
|
161
|
+
<div className='flex flex-col gap-6'>
|
|
162
|
+
<Breadcrumb
|
|
163
|
+
appearance='outline'
|
|
164
|
+
items={[
|
|
165
|
+
{ label: 'Home', href: '/', icon: Home },
|
|
166
|
+
{ label: 'Components', href: '/components' },
|
|
167
|
+
{ label: 'Chip' },
|
|
168
|
+
]}
|
|
169
|
+
separator='>'
|
|
170
|
+
/>
|
|
171
|
+
|
|
172
|
+
<Chip appearance='filled' icon={Tag} shape='circle' variant='primary'>
|
|
173
|
+
Filter
|
|
174
|
+
</Chip>
|
|
175
|
+
|
|
176
|
+
<CheckboxGroup
|
|
177
|
+
label='Notification channels'
|
|
178
|
+
options={[
|
|
179
|
+
{ label: 'Email', value: 'email' },
|
|
180
|
+
{ label: 'SMS', value: 'sms' },
|
|
181
|
+
]}
|
|
182
|
+
shape='square'
|
|
183
|
+
/>
|
|
184
|
+
|
|
185
|
+
<Divider>
|
|
186
|
+
<Button leadingIcon={Plus} size='sm' variant='default'>
|
|
187
|
+
Add item
|
|
188
|
+
</Button>
|
|
189
|
+
</Divider>
|
|
190
|
+
</div>
|
|
191
|
+
);
|
|
192
|
+
}
|
|
193
|
+
```
|
|
194
|
+
|
|
195
|
+
### Component Notes
|
|
196
|
+
|
|
197
|
+
- `Breadcrumb` supports `appearance="ghost" | "outline"` and `separator=">" | "/"`. The chevron separator is rendered as an icon.
|
|
198
|
+
- `Checkbox` and `CheckboxGroup` support `shape="square" | "circle"`, with `square` as the default.
|
|
199
|
+
- `Chip` supports `variant`, `appearance="filled" | "outline"`, `shape`, `size`, `inverted`, optional `icon`, and removable chips via `onClose`.
|
|
200
|
+
- `Divider` supports `orientation="horizontal" | "vertical"` and optional centered content through `children`.
|
|
201
|
+
|
|
134
202
|
### Documentation and examples
|
|
135
203
|
|
|
136
204
|
- Storybook: run locally with `npm run storybook`
|
|
@@ -140,7 +208,6 @@ If your app uses a custom design token strategy, import one packaged theme and o
|
|
|
140
208
|
|
|
141
209
|
- Component style variants are centralized with CVA + Tailwind utility patterns.
|
|
142
210
|
- Theme tokens are built in and theme files are exported from package entry points:
|
|
143
|
-
- `theme-primary.css`
|
|
144
211
|
- `theme-secondary.css`
|
|
145
212
|
- `globals.css`
|
|
146
213
|
|
|
@@ -235,14 +302,20 @@ src/
|
|
|
235
302
|
|
|
236
303
|
## Components
|
|
237
304
|
|
|
238
|
-
| Component
|
|
239
|
-
|
|
|
240
|
-
|
|
|
241
|
-
|
|
|
242
|
-
| Avatar
|
|
243
|
-
| AvatarGroup
|
|
244
|
-
|
|
|
245
|
-
|
|
|
305
|
+
| Component | Location | Storybook | Status |
|
|
306
|
+
| ----------------- | ---------------------------------- | ------------------------------------------------------------------------------------------------------------- | ------ |
|
|
307
|
+
| Accordion | `src/components/Accordion` | [Accordion](https://tanishraj.github.io/ui-kit/?path=/story/components-accordion--default) | Stable |
|
|
308
|
+
| Alert | `src/components/Alert` | [Alert](https://tanishraj.github.io/ui-kit/?path=/story/components-alert--default) | Stable |
|
|
309
|
+
| Avatar | `src/components/Avatar` | [Avatar](https://tanishraj.github.io/ui-kit/?path=/story/components-avatar--playground) | Stable |
|
|
310
|
+
| AvatarGroup | `src/components/AvatarGroup` | [AvatarGroup](https://tanishraj.github.io/ui-kit/?path=/story/components-avatargroup--default) | Stable |
|
|
311
|
+
| Badge | `src/components/Badge` | [Badge](https://tanishraj.github.io/ui-kit/?path=/story/components-badge--playground) | Stable |
|
|
312
|
+
| Breadcrumb | `src/components/Breadcrumb` | [Breadcrumb](https://tanishraj.github.io/ui-kit/?path=/story/components-breadcrumb--playground) | Stable |
|
|
313
|
+
| Button | `src/components/Button` | [Button](https://tanishraj.github.io/ui-kit/?path=/story/components-button--playground) | Stable |
|
|
314
|
+
| ButtonGroup | `src/components/ButtonGroup` | [ButtonGroup](https://tanishraj.github.io/ui-kit/?path=/story/components-buttongroup--playground) | Stable |
|
|
315
|
+
| Checkbox | `src/components/Checkbox` | [Checkbox](https://tanishraj.github.io/ui-kit/?path=/story/components-checkbox--playground) | Stable |
|
|
316
|
+
| CheckboxGroup | `src/components/CheckboxGroup` | [CheckboxGroup](https://tanishraj.github.io/ui-kit/?path=/story/components-checkboxgroup--playground) | Stable |
|
|
317
|
+
| Chip | `src/components/Chip` | [Chip](https://tanishraj.github.io/ui-kit/?path=/story/components-chip--playground) | Stable |
|
|
318
|
+
| Divider | `src/components/Divider` | [Divider](https://tanishraj.github.io/ui-kit/?path=/story/components-divider--playground) | Stable |
|
|
246
319
|
| OrganizationChart | `src/components/OrganizationChart` | [OrganizationChart](https://tanishraj.github.io/ui-kit/?path=/story/components-organizationchart--playground) | Stable |
|
|
247
320
|
|
|
248
321
|
## Versioning and Changelog
|