@bricks-toolkit/toolkit 0.1.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/LICENSE +21 -0
- package/README.md +214 -0
- package/dist/components/Accordion/Accordion.d.ts +5 -0
- package/dist/components/Accordion/Accordion.types.d.ts +32 -0
- package/dist/components/Accordion/index.d.ts +2 -0
- package/dist/components/Avatar/Avatar.d.ts +2 -0
- package/dist/components/Avatar/Avatar.stories.d.ts +11 -0
- package/dist/components/Avatar/Avatar.test.d.ts +1 -0
- package/dist/components/Avatar/Avatar.types.d.ts +24 -0
- package/dist/components/Avatar/index.d.ts +2 -0
- package/dist/components/Badge/Badge.d.ts +11 -0
- package/dist/components/Badge/Badge.stories.d.ts +21 -0
- package/dist/components/Badge/Badge.test.d.ts +1 -0
- package/dist/components/Badge/Badge.types.d.ts +43 -0
- package/dist/components/Badge/index.d.ts +2 -0
- package/dist/components/Breadcrumbs/Breadcrumbs.d.ts +2 -0
- package/dist/components/Breadcrumbs/Breadcrumbs.stories.d.ts +13 -0
- package/dist/components/Breadcrumbs/Breadcrumbs.test.d.ts +1 -0
- package/dist/components/Breadcrumbs/Breadcrumbs.types.d.ts +27 -0
- package/dist/components/Breadcrumbs/index.d.ts +2 -0
- package/dist/components/Button/Button.d.ts +2 -0
- package/dist/components/Button/Button.stories.d.ts +20 -0
- package/dist/components/Button/Button.test.d.ts +1 -0
- package/dist/components/Button/Button.types.d.ts +24 -0
- package/dist/components/Button/index.d.ts +2 -0
- package/dist/components/Card/Card.d.ts +25 -0
- package/dist/components/Card/Card.stories.d.ts +8 -0
- package/dist/components/Card/Card.test.d.ts +1 -0
- package/dist/components/Card/Card.types.d.ts +14 -0
- package/dist/components/Card/index.d.ts +2 -0
- package/dist/components/Checkbox/Checkbox.d.ts +2 -0
- package/dist/components/Checkbox/Checkbox.stories.d.ts +16 -0
- package/dist/components/Checkbox/Checkbox.test.d.ts +1 -0
- package/dist/components/Checkbox/Checkbox.types.d.ts +31 -0
- package/dist/components/Checkbox/index.d.ts +2 -0
- package/dist/components/ComboBox/ComboBox.d.ts +2 -0
- package/dist/components/ComboBox/ComboBox.stories.d.ts +12 -0
- package/dist/components/ComboBox/ComboBox.test.d.ts +1 -0
- package/dist/components/ComboBox/ComboBox.types.d.ts +57 -0
- package/dist/components/ComboBox/index.d.ts +2 -0
- package/dist/components/DatePicker/DatePicker.d.ts +2 -0
- package/dist/components/DatePicker/DatePicker.stories.d.ts +25 -0
- package/dist/components/DatePicker/DatePicker.test.d.ts +1 -0
- package/dist/components/DatePicker/DatePicker.types.d.ts +27 -0
- package/dist/components/DatePicker/index.d.ts +2 -0
- package/dist/components/Dialog/Dialog.d.ts +6 -0
- package/dist/components/Dialog/Dialog.stories.d.ts +9 -0
- package/dist/components/Dialog/Dialog.test.d.ts +1 -0
- package/dist/components/Dialog/Dialog.types.d.ts +52 -0
- package/dist/components/Dialog/index.d.ts +2 -0
- package/dist/components/DropdownMenu/DropdownMenu.d.ts +7 -0
- package/dist/components/DropdownMenu/DropdownMenu.stories.d.ts +9 -0
- package/dist/components/DropdownMenu/DropdownMenu.test.d.ts +1 -0
- package/dist/components/DropdownMenu/DropdownMenu.types.d.ts +24 -0
- package/dist/components/DropdownMenu/index.d.ts +2 -0
- package/dist/components/Email/Email.d.ts +2 -0
- package/dist/components/Email/Email.stories.d.ts +11 -0
- package/dist/components/Email/Email.test.d.ts +1 -0
- package/dist/components/Email/Email.types.d.ts +33 -0
- package/dist/components/Email/index.d.ts +2 -0
- package/dist/components/FileUpload/FileUpload.d.ts +2 -0
- package/dist/components/FileUpload/FileUpload.stories.d.ts +10 -0
- package/dist/components/FileUpload/FileUpload.test.d.ts +1 -0
- package/dist/components/FileUpload/FileUpload.types.d.ts +22 -0
- package/dist/components/FileUpload/index.d.ts +2 -0
- package/dist/components/Header/Header.d.ts +7 -0
- package/dist/components/Header/Header.stories.d.ts +8 -0
- package/dist/components/Header/Header.test.d.ts +1 -0
- package/dist/components/Header/Header.types.d.ts +19 -0
- package/dist/components/Header/index.d.ts +2 -0
- package/dist/components/IconButton/IconButton.d.ts +2 -0
- package/dist/components/IconButton/IconButton.stories.d.ts +17 -0
- package/dist/components/IconButton/IconButton.types.d.ts +10 -0
- package/dist/components/IconButton/index.d.ts +2 -0
- package/dist/components/Image/Image.d.ts +6 -0
- package/dist/components/Image/Image.stories.d.ts +13 -0
- package/dist/components/Image/Image.test.d.ts +1 -0
- package/dist/components/Image/Image.types.d.ts +40 -0
- package/dist/components/Image/index.d.ts +2 -0
- package/dist/components/Link/Link.d.ts +2 -0
- package/dist/components/Link/Link.stories.d.ts +15 -0
- package/dist/components/Link/Link.test.d.ts +1 -0
- package/dist/components/Link/Link.types.d.ts +20 -0
- package/dist/components/Link/index.d.ts +2 -0
- package/dist/components/Loader/Loader.d.ts +2 -0
- package/dist/components/Loader/Loader.stories.d.ts +12 -0
- package/dist/components/Loader/Loader.test.d.ts +1 -0
- package/dist/components/Loader/Loader.types.d.ts +17 -0
- package/dist/components/Loader/index.d.ts +2 -0
- package/dist/components/Modal/Modal.d.ts +14 -0
- package/dist/components/Modal/Modal.stories.d.ts +14 -0
- package/dist/components/Modal/Modal.test.d.ts +1 -0
- package/dist/components/Modal/Modal.types.d.ts +100 -0
- package/dist/components/Modal/index.d.ts +2 -0
- package/dist/components/MultiSelect/MultiSelect.d.ts +2 -0
- package/dist/components/MultiSelect/MultiSelect.stories.d.ts +15 -0
- package/dist/components/MultiSelect/MultiSelect.test.d.ts +1 -0
- package/dist/components/MultiSelect/MultiSelect.types.d.ts +55 -0
- package/dist/components/MultiSelect/index.d.ts +2 -0
- package/dist/components/OtpInput/OtpInput.d.ts +2 -0
- package/dist/components/OtpInput/OtpInput.stories.d.ts +10 -0
- package/dist/components/OtpInput/OtpInput.test.d.ts +1 -0
- package/dist/components/OtpInput/OtpInput.types.d.ts +53 -0
- package/dist/components/OtpInput/index.d.ts +2 -0
- package/dist/components/PasswordInput/PasswordInput.d.ts +2 -0
- package/dist/components/PasswordInput/PasswordInput.stories.d.ts +23 -0
- package/dist/components/PasswordInput/PasswordInput.test.d.ts +1 -0
- package/dist/components/PasswordInput/PasswordInput.types.d.ts +27 -0
- package/dist/components/PasswordInput/index.d.ts +2 -0
- package/dist/components/Phone/Phone.d.ts +2 -0
- package/dist/components/Phone/Phone.stories.d.ts +11 -0
- package/dist/components/Phone/Phone.test.d.ts +1 -0
- package/dist/components/Phone/Phone.types.d.ts +36 -0
- package/dist/components/Phone/countries.d.ts +8 -0
- package/dist/components/Phone/index.d.ts +2 -0
- package/dist/components/RadioButton/RadioButton.d.ts +2 -0
- package/dist/components/RadioButton/RadioButton.stories.d.ts +21 -0
- package/dist/components/RadioButton/RadioButton.test.d.ts +1 -0
- package/dist/components/RadioButton/RadioButton.types.d.ts +51 -0
- package/dist/components/RadioButton/index.d.ts +2 -0
- package/dist/components/SearchInput/SearchInput.d.ts +6 -0
- package/dist/components/SearchInput/SearchInput.stories.d.ts +8 -0
- package/dist/components/SearchInput/SearchInput.test.d.ts +1 -0
- package/dist/components/SearchInput/SearchInput.types.d.ts +12 -0
- package/dist/components/SearchInput/index.d.ts +2 -0
- package/dist/components/Select/Select.d.ts +2 -0
- package/dist/components/Select/Select.stories.d.ts +12 -0
- package/dist/components/Select/Select.test.d.ts +1 -0
- package/dist/components/Select/Select.types.d.ts +31 -0
- package/dist/components/Select/index.d.ts +2 -0
- package/dist/components/Sidebar/Sidebar.d.ts +7 -0
- package/dist/components/Sidebar/Sidebar.stories.d.ts +10 -0
- package/dist/components/Sidebar/Sidebar.test.d.ts +1 -0
- package/dist/components/Sidebar/Sidebar.types.d.ts +87 -0
- package/dist/components/Sidebar/index.d.ts +2 -0
- package/dist/components/Skeleton/Skeleton.d.ts +26 -0
- package/dist/components/Skeleton/Skeleton.stories.d.ts +13 -0
- package/dist/components/Skeleton/Skeleton.types.d.ts +47 -0
- package/dist/components/Skeleton/index.d.ts +2 -0
- package/dist/components/Stepper/Stepper.d.ts +2 -0
- package/dist/components/Stepper/Stepper.stories.d.ts +23 -0
- package/dist/components/Stepper/Stepper.test.d.ts +1 -0
- package/dist/components/Stepper/Stepper.types.d.ts +47 -0
- package/dist/components/Stepper/index.d.ts +2 -0
- package/dist/components/Table/Pagination.d.ts +3 -0
- package/dist/components/Table/Table.d.ts +3 -0
- package/dist/components/Table/Table.stories.d.ts +13 -0
- package/dist/components/Table/Table.test.d.ts +1 -0
- package/dist/components/Table/Table.types.d.ts +85 -0
- package/dist/components/Table/index.d.ts +3 -0
- package/dist/components/Tabs/Tabs.d.ts +2 -0
- package/dist/components/Tabs/Tabs.stories.d.ts +17 -0
- package/dist/components/Tabs/Tabs.test.d.ts +1 -0
- package/dist/components/Tabs/Tabs.types.d.ts +21 -0
- package/dist/components/Tabs/index.d.ts +2 -0
- package/dist/components/TextInput/TextInput.d.ts +2 -0
- package/dist/components/TextInput/TextInput.stories.d.ts +25 -0
- package/dist/components/TextInput/TextInput.test.d.ts +1 -0
- package/dist/components/TextInput/TextInput.types.d.ts +29 -0
- package/dist/components/TextInput/index.d.ts +2 -0
- package/dist/components/ThemeProvider/ThemeProvider.d.ts +8 -0
- package/dist/components/ThemeProvider/ThemeProvider.stories.d.ts +16 -0
- package/dist/components/ThemeProvider/ThemeProvider.test.d.ts +1 -0
- package/dist/components/ThemeProvider/ThemeProvider.types.d.ts +112 -0
- package/dist/components/ThemeProvider/index.d.ts +2 -0
- package/dist/components/TimePicker/TimePicker.d.ts +2 -0
- package/dist/components/TimePicker/TimePicker.stories.d.ts +23 -0
- package/dist/components/TimePicker/TimePicker.test.d.ts +1 -0
- package/dist/components/TimePicker/TimePicker.types.d.ts +27 -0
- package/dist/components/TimePicker/index.d.ts +2 -0
- package/dist/components/Toaster/Toaster.d.ts +2 -0
- package/dist/components/Toaster/Toaster.stories.d.ts +13 -0
- package/dist/components/Toaster/Toaster.test.d.ts +1 -0
- package/dist/components/Toaster/Toaster.types.d.ts +23 -0
- package/dist/components/Toaster/index.d.ts +2 -0
- package/dist/components/Toggle/Toggle.d.ts +2 -0
- package/dist/components/Toggle/Toggle.stories.d.ts +11 -0
- package/dist/components/Toggle/Toggle.types.d.ts +10 -0
- package/dist/components/Toggle/index.d.ts +2 -0
- package/dist/components/Tooltip/Tooltip.d.ts +2 -0
- package/dist/components/Tooltip/Tooltip.stories.d.ts +13 -0
- package/dist/components/Tooltip/Tooltip.test.d.ts +1 -0
- package/dist/components/Tooltip/Tooltip.types.d.ts +33 -0
- package/dist/components/Tooltip/index.d.ts +2 -0
- package/dist/index.d.ts +75 -0
- package/dist/utils/cn.d.ts +2 -0
- package/dist/utils/index.d.ts +1 -0
- package/package.json +481 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2024 ITProfound
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,214 @@
|
|
|
1
|
+
# bricks
|
|
2
|
+
|
|
3
|
+
[](https://www.npmjs.com/package/@bricks-toolkit/toolkit)
|
|
4
|
+
[](https://www.typescriptlang.org/)
|
|
5
|
+
[](./LICENSE)
|
|
6
|
+
|
|
7
|
+
> Micro-modularized, fully independent, type-safe UI component library built with TypeScript and Tailwind CSS.
|
|
8
|
+
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
## ✨ Features
|
|
12
|
+
|
|
13
|
+
- 🔷 **Fully TypeScript** — strict mode, all props fully typed and exported
|
|
14
|
+
- 🎨 **Tailwind CSS** — utility-first, zero CSS-in-JS
|
|
15
|
+
- 📦 **Dual ESM + CJS** — works in any modern bundler (Vite, Webpack, Rollup, esbuild)
|
|
16
|
+
- 🌲 **Tree-shakeable** — sub-path imports (`bricks/text-input`)
|
|
17
|
+
- 📖 **Storybook** — interactive docs for every component and variant
|
|
18
|
+
- 🧪 **Fully tested** — Vitest + @testing-library/react (≥ 80% coverage)
|
|
19
|
+
- ♿ **Accessible** — ARIA attributes, roles, and keyboard support built-in
|
|
20
|
+
- 🔄 **forwardRef** — full DOM access on every component
|
|
21
|
+
- 🔒 **Strict ESLint** — typescript-eslint strict + react + jsx-a11y
|
|
22
|
+
- 📏 **Prettier** — consistent formatting enforced via pre-commit hook
|
|
23
|
+
|
|
24
|
+
---
|
|
25
|
+
|
|
26
|
+
## 📦 Installation
|
|
27
|
+
|
|
28
|
+
```bash
|
|
29
|
+
# npm
|
|
30
|
+
npm install @bricks-toolkit/toolkit
|
|
31
|
+
|
|
32
|
+
# Or with yarn
|
|
33
|
+
yarn add @bricks-toolkit/toolkit
|
|
34
|
+
|
|
35
|
+
# Or with pnpm
|
|
36
|
+
pnpm add @bricks-toolkit/toolkit
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
**Peer dependencies** (must be installed by the consumer):
|
|
40
|
+
|
|
41
|
+
```bash
|
|
42
|
+
pnpm add react react-dom
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
---
|
|
46
|
+
|
|
47
|
+
## 🎨 Tailwind CSS Setup
|
|
48
|
+
|
|
49
|
+
This library ships Tailwind class names. You have two options:
|
|
50
|
+
|
|
51
|
+
### Option A — Consumer runs Tailwind (recommended)
|
|
52
|
+
|
|
53
|
+
Add the library's source to your Tailwind `content` paths so Tailwind
|
|
54
|
+
generates the required utilities:
|
|
55
|
+
|
|
56
|
+
```ts
|
|
57
|
+
// tailwind.config.ts
|
|
58
|
+
import type { Config } from 'tailwindcss'
|
|
59
|
+
|
|
60
|
+
export default {
|
|
61
|
+
content: [
|
|
62
|
+
'./src/**/*.{ts,tsx}',
|
|
63
|
+
// Add the library's dist path:
|
|
64
|
+
'./node_modules/@bricks-toolkit/toolkit/dist/**/*.js',
|
|
65
|
+
],
|
|
66
|
+
} satisfies Config
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
### Option B — Use the pre-built CSS
|
|
70
|
+
|
|
71
|
+
```ts
|
|
72
|
+
// In your entry file (e.g. main.tsx)
|
|
73
|
+
import '@bricks-toolkit/toolkit/styles.css'
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
---
|
|
77
|
+
|
|
78
|
+
## 🚀 Usage
|
|
79
|
+
|
|
80
|
+
### Named import (full bundle)
|
|
81
|
+
|
|
82
|
+
```tsx
|
|
83
|
+
import { TextInput } from '@bricks-toolkit/toolkit'
|
|
84
|
+
|
|
85
|
+
function App() {
|
|
86
|
+
return (
|
|
87
|
+
<TextInput
|
|
88
|
+
label="Email address"
|
|
89
|
+
placeholder="you@example.com"
|
|
90
|
+
type="email"
|
|
91
|
+
state="error"
|
|
92
|
+
errorMessage="Please enter a valid email"
|
|
93
|
+
/>
|
|
94
|
+
)
|
|
95
|
+
}
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
### Sub-path import (tree-shakeable)
|
|
99
|
+
|
|
100
|
+
```tsx
|
|
101
|
+
import { TextInput } from '@bricks-toolkit/toolkit/text-input'
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
---
|
|
105
|
+
|
|
106
|
+
## 📖 TextInput
|
|
107
|
+
|
|
108
|
+
### Props
|
|
109
|
+
|
|
110
|
+
| Prop | Type | Default | Description |
|
|
111
|
+
| --------------------- | -------------------------------------------------- | ----------- | ---------------------------------- |
|
|
112
|
+
| `label` | `string` | — | Visible label above the input |
|
|
113
|
+
| `required` | `boolean` | `false` | Shows a `*` on the label |
|
|
114
|
+
| `helperText` | `string` | — | Help text below the input |
|
|
115
|
+
| `errorMessage` | `string` | — | Shown when `state="error"` |
|
|
116
|
+
| `successMessage` | `string` | — | Shown when `state="success"` |
|
|
117
|
+
| `warningMessage` | `string` | — | Shown when `state="warning"` |
|
|
118
|
+
| `variant` | `'default' \| 'filled' \| 'flushed' \| 'unstyled'` | `'default'` | Visual style |
|
|
119
|
+
| `size` | `'xs' \| 'sm' \| 'md' \| 'lg' \| 'xl'` | `'md'` | Field size |
|
|
120
|
+
| `state` | `'default' \| 'error' \| 'success' \| 'warning'` | `'default'` | Validation state |
|
|
121
|
+
| `fullWidth` | `boolean` | `true` | Span container width |
|
|
122
|
+
| `leftElement` | `ReactNode` | — | Inline icon/element on left |
|
|
123
|
+
| `rightElement` | `ReactNode` | — | Inline icon/element on right |
|
|
124
|
+
| `prefix` | `ReactNode` | — | Addon label attached outside-left |
|
|
125
|
+
| `suffix` | `ReactNode` | — | Addon label attached outside-right |
|
|
126
|
+
| `wrapperClassName` | `string` | — | Classes on the outer wrapper |
|
|
127
|
+
| `inputGroupClassName` | `string` | — | Classes on the input group |
|
|
128
|
+
| `inputClassName` | `string` | — | Classes on the `<input>` element |
|
|
129
|
+
| `labelClassName` | `string` | — | Classes on the label |
|
|
130
|
+
| `helperClassName` | `string` | — | Classes on the helper text |
|
|
131
|
+
|
|
132
|
+
> All native `<input>` attributes (`placeholder`, `name`, `value`, `onChange`, `onBlur`, `type`, `maxLength`, `autoComplete`, ...) are supported via prop spread.
|
|
133
|
+
|
|
134
|
+
### Exported Types
|
|
135
|
+
|
|
136
|
+
```ts
|
|
137
|
+
import type { TextInputProps, TextInputVariant, TextInputSize, TextInputState } from '@bricks-toolkit/toolkit'
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
### Examples
|
|
141
|
+
|
|
142
|
+
```tsx
|
|
143
|
+
// Variants
|
|
144
|
+
<TextInput variant="filled" label="Filled" placeholder="..." />
|
|
145
|
+
<TextInput variant="flushed" label="Flushed" placeholder="..." />
|
|
146
|
+
|
|
147
|
+
// Sizes
|
|
148
|
+
<TextInput size="xs" placeholder="Extra small" />
|
|
149
|
+
<TextInput size="xl" placeholder="Extra large" />
|
|
150
|
+
|
|
151
|
+
// Validation
|
|
152
|
+
<TextInput state="error" errorMessage="This field is required" />
|
|
153
|
+
<TextInput state="success" successMessage="Looks good!" />
|
|
154
|
+
|
|
155
|
+
// Icons
|
|
156
|
+
<TextInput leftElement={<SearchIcon />} placeholder="Search…" />
|
|
157
|
+
|
|
158
|
+
// Addons
|
|
159
|
+
<TextInput prefix="https://" suffix=".com" placeholder="yoursite" />
|
|
160
|
+
|
|
161
|
+
// Ref
|
|
162
|
+
const ref = useRef<HTMLInputElement>(null)
|
|
163
|
+
<TextInput ref={ref} placeholder="Focus me" />
|
|
164
|
+
```
|
|
165
|
+
|
|
166
|
+
---
|
|
167
|
+
|
|
168
|
+
## 🛠 Development
|
|
169
|
+
|
|
170
|
+
```bash
|
|
171
|
+
# Install dependencies
|
|
172
|
+
pnpm install
|
|
173
|
+
|
|
174
|
+
# Start Storybook
|
|
175
|
+
pnpm storybook
|
|
176
|
+
|
|
177
|
+
# Run tests
|
|
178
|
+
pnpm test
|
|
179
|
+
|
|
180
|
+
# Run tests with coverage
|
|
181
|
+
pnpm test:coverage
|
|
182
|
+
|
|
183
|
+
# Build
|
|
184
|
+
pnpm build
|
|
185
|
+
|
|
186
|
+
# Lint
|
|
187
|
+
pnpm lint
|
|
188
|
+
|
|
189
|
+
# Format
|
|
190
|
+
pnpm format
|
|
191
|
+
```
|
|
192
|
+
|
|
193
|
+
---
|
|
194
|
+
|
|
195
|
+
## 🔖 Versioning
|
|
196
|
+
|
|
197
|
+
This project uses [Changesets](https://github.com/changesets/changesets) for versioning and changelog generation.
|
|
198
|
+
|
|
199
|
+
```bash
|
|
200
|
+
# Create a changeset
|
|
201
|
+
pnpm changeset
|
|
202
|
+
|
|
203
|
+
# Version packages
|
|
204
|
+
pnpm changeset version
|
|
205
|
+
|
|
206
|
+
# Publish
|
|
207
|
+
pnpm changeset publish
|
|
208
|
+
```
|
|
209
|
+
|
|
210
|
+
---
|
|
211
|
+
|
|
212
|
+
## 📄 License
|
|
213
|
+
|
|
214
|
+
MIT © [elaachiadmin](https://bitbucket.org/elaachiadmin/itprofound-ui-kit)
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { AccordionProps, AccordionItemProps, AccordionTriggerProps, AccordionContentProps } from './Accordion.types';
|
|
2
|
+
export declare const AccordionItem: ({ children, className, isOpen: controlledIsOpen, onToggle, disabled, }: AccordionItemProps) => React.ReactElement;
|
|
3
|
+
export declare const AccordionTrigger: ({ children, className, hideChevron, icon, rightContent, }: AccordionTriggerProps) => React.ReactElement;
|
|
4
|
+
export declare const AccordionContent: ({ children, className, }: AccordionContentProps) => React.ReactElement | null;
|
|
5
|
+
export declare const Accordion: ({ children, className, allowMultiple, defaultOpenIndices, }: AccordionProps) => React.ReactElement;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import type { ReactNode } from 'react';
|
|
2
|
+
export interface AccordionProps {
|
|
3
|
+
children: ReactNode;
|
|
4
|
+
className?: string;
|
|
5
|
+
allowMultiple?: boolean;
|
|
6
|
+
defaultOpenIndices?: number[];
|
|
7
|
+
}
|
|
8
|
+
export interface AccordionItemProps {
|
|
9
|
+
children: ReactNode;
|
|
10
|
+
className?: string;
|
|
11
|
+
/**
|
|
12
|
+
* Optional manual control over open state.
|
|
13
|
+
* If provided, the Accordion's internal group logic is ignored for this item.
|
|
14
|
+
*/
|
|
15
|
+
isOpen?: boolean;
|
|
16
|
+
onToggle?: () => void;
|
|
17
|
+
disabled?: boolean;
|
|
18
|
+
}
|
|
19
|
+
export interface AccordionTriggerProps {
|
|
20
|
+
children: ReactNode;
|
|
21
|
+
className?: string;
|
|
22
|
+
/** Hide the default chevron icon */
|
|
23
|
+
hideChevron?: boolean;
|
|
24
|
+
/** Provide a custom icon instead of the default chevron */
|
|
25
|
+
icon?: ReactNode;
|
|
26
|
+
/** Extra content rendered on the right, independent of the toggle button */
|
|
27
|
+
rightContent?: ReactNode;
|
|
28
|
+
}
|
|
29
|
+
export interface AccordionContentProps {
|
|
30
|
+
children: ReactNode;
|
|
31
|
+
className?: string;
|
|
32
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/react-vite';
|
|
2
|
+
import { Avatar } from './Avatar';
|
|
3
|
+
declare const meta: Meta<typeof Avatar>;
|
|
4
|
+
export default meta;
|
|
5
|
+
type Story = StoryObj<typeof meta>;
|
|
6
|
+
export declare const Default: Story;
|
|
7
|
+
export declare const Initials: Story;
|
|
8
|
+
export declare const Sizes: Story;
|
|
9
|
+
export declare const Variants: Story;
|
|
10
|
+
export declare const StateBadges: Story;
|
|
11
|
+
export declare const StateBorders: Story;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { ImgHTMLAttributes, ReactNode } from 'react';
|
|
2
|
+
export type AvatarSize = '2xs' | 'xs' | 'sm' | 'md' | 'lg' | 'xl' | '2xl' | '3xl' | '4xl';
|
|
3
|
+
export type AvatarVariant = 'circle' | 'square' | 'rounded';
|
|
4
|
+
export type AvatarState = 'default' | 'error' | 'success' | 'warning' | 'offline' | 'online' | 'busy' | 'away';
|
|
5
|
+
export interface AvatarProps extends Omit<ImgHTMLAttributes<HTMLImageElement>, 'size'> {
|
|
6
|
+
/** Size of the avatar */
|
|
7
|
+
size?: AvatarSize;
|
|
8
|
+
/** Shape variant of the avatar */
|
|
9
|
+
variant?: AvatarVariant;
|
|
10
|
+
/** State indicator for the avatar (e.g. online status or validation) */
|
|
11
|
+
state?: AvatarState;
|
|
12
|
+
/** Determines if the state indicator should be a border or a dot (badge). Default is border. */
|
|
13
|
+
stateType?: 'border' | 'badge';
|
|
14
|
+
/** Fallback content when image is not provided or fails to load. Can be initials string or a ReactNode */
|
|
15
|
+
fallback?: ReactNode;
|
|
16
|
+
/** Alt text for the image, also used to generate initials if fallback string is not provided */
|
|
17
|
+
alt?: string;
|
|
18
|
+
/** Image source URL */
|
|
19
|
+
src?: string;
|
|
20
|
+
/** Class name applied to the outer container */
|
|
21
|
+
containerClassName?: string;
|
|
22
|
+
/** Class name applied to the fallback element */
|
|
23
|
+
fallbackClassName?: string;
|
|
24
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { BadgeProps } from './Badge.types';
|
|
2
|
+
/**
|
|
3
|
+
* `Badge` — a highly composable inline label component.
|
|
4
|
+
*
|
|
5
|
+
* @example
|
|
6
|
+
* <Badge color="green" variant="soft">Active</Badge>
|
|
7
|
+
* <Badge color="red" variant="gradient" size="lg" shape="rounded">Critical</Badge>
|
|
8
|
+
* <Badge color="blue" variant="dot" pulse>Live</Badge>
|
|
9
|
+
* <Badge count={42} color="red" variant="solid" shape="pill" />
|
|
10
|
+
*/
|
|
11
|
+
export declare function Badge({ children, variant, color, size, shape, icon, trailingIcon, onRemove, pulse, count, maxCount, uppercase, tracking, as: Tag, className, ...rest }: BadgeProps): React.JSX.Element;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/react-vite';
|
|
2
|
+
import { Badge } from './Badge';
|
|
3
|
+
declare const meta: Meta<typeof Badge>;
|
|
4
|
+
export default meta;
|
|
5
|
+
type Story = StoryObj<typeof meta>;
|
|
6
|
+
export declare const Default: Story;
|
|
7
|
+
export declare const Variants: Story;
|
|
8
|
+
export declare const Colors: Story;
|
|
9
|
+
export declare const GradientColors: Story;
|
|
10
|
+
export declare const SolidColors: Story;
|
|
11
|
+
export declare const Sizes: Story;
|
|
12
|
+
export declare const Shapes: Story;
|
|
13
|
+
export declare const StatusBadges: Story;
|
|
14
|
+
export declare const PulseDot: Story;
|
|
15
|
+
export declare const WithLeadingIcon: Story;
|
|
16
|
+
export declare const WithTrailingIcon: Story;
|
|
17
|
+
export declare const Removable: Story;
|
|
18
|
+
export declare const CountBadge: Story;
|
|
19
|
+
export declare const TextStyling: Story;
|
|
20
|
+
export declare const PolymorphicAnchor: Story;
|
|
21
|
+
export declare const KitchenSink: Story;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import type { ElementType, ReactNode } from 'react';
|
|
2
|
+
/** Visual style of the badge. */
|
|
3
|
+
export type BadgeVariant = 'solid' | 'soft' | 'outline' | 'dot' | 'gradient';
|
|
4
|
+
/** Color palette for the badge. */
|
|
5
|
+
export type BadgeColor = 'primary' | 'secondary' | 'success' | 'error' | 'warning' | 'info' | 'accent' | 'gray' | 'blue' | 'green' | 'red' | 'yellow' | 'purple' | 'pink' | 'orange' | 'cyan' | 'teal' | 'indigo';
|
|
6
|
+
/** Size token for the badge. */
|
|
7
|
+
export type BadgeSize = 'xs' | 'sm' | 'md' | 'lg';
|
|
8
|
+
/** Border-radius shape. */
|
|
9
|
+
export type BadgeShape = 'rounded' | 'pill' | 'square';
|
|
10
|
+
export interface BadgeProps {
|
|
11
|
+
/** Text or content inside the badge. */
|
|
12
|
+
children?: ReactNode;
|
|
13
|
+
/** Visual style. Defaults to `'soft'`. */
|
|
14
|
+
variant?: BadgeVariant;
|
|
15
|
+
/** Color scheme. Defaults to `'blue'`. */
|
|
16
|
+
color?: BadgeColor;
|
|
17
|
+
/** Size. Defaults to `'md'`. */
|
|
18
|
+
size?: BadgeSize;
|
|
19
|
+
/** Border-radius shape. Defaults to `'pill'`. */
|
|
20
|
+
shape?: BadgeShape;
|
|
21
|
+
/** Optional icon rendered before the label. */
|
|
22
|
+
icon?: ReactNode;
|
|
23
|
+
/** Optional icon rendered after the label (before the remove button). */
|
|
24
|
+
trailingIcon?: ReactNode;
|
|
25
|
+
/** When provided, renders a remove (×) button and calls this on click. */
|
|
26
|
+
onRemove?: () => void;
|
|
27
|
+
/** Adds a pulsing animation to the dot indicator (only works with `variant="dot"`). */
|
|
28
|
+
pulse?: boolean;
|
|
29
|
+
/** Renders a numeric count instead of (or alongside) children. When > maxCount, shows `{maxCount}+`. */
|
|
30
|
+
count?: number;
|
|
31
|
+
/** Maximum count before the overflow label is shown. Defaults to 99. */
|
|
32
|
+
maxCount?: number;
|
|
33
|
+
/** Uppercases the badge text. */
|
|
34
|
+
uppercase?: boolean;
|
|
35
|
+
/** Adds a soft letter-spacing for label readability. */
|
|
36
|
+
tracking?: boolean;
|
|
37
|
+
/** Polymorphic element override (e.g. `'a'`, `'button'`, `'li'`). Defaults to `'span'`. */
|
|
38
|
+
as?: ElementType;
|
|
39
|
+
/** Additional class name. */
|
|
40
|
+
className?: string;
|
|
41
|
+
/** Any other HTML / element props (e.g. `href`, `onClick`, `aria-*`). */
|
|
42
|
+
[key: string]: unknown;
|
|
43
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/react-vite';
|
|
2
|
+
import { Breadcrumbs } from './Breadcrumbs';
|
|
3
|
+
declare const meta: Meta<typeof Breadcrumbs>;
|
|
4
|
+
export default meta;
|
|
5
|
+
type Story = StoryObj<typeof meta>;
|
|
6
|
+
export declare const Default: Story;
|
|
7
|
+
export declare const SlashSeparator: Story;
|
|
8
|
+
export declare const DotSeparator: Story;
|
|
9
|
+
export declare const CustomSeparator: Story;
|
|
10
|
+
export declare const Sizes: Story;
|
|
11
|
+
export declare const Collapsible: Story;
|
|
12
|
+
export declare const WithDisabledCrumb: Story;
|
|
13
|
+
export declare const OnClickNavigation: Story;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { ReactNode, ReactElement } from 'react';
|
|
2
|
+
export interface BreadcrumbItem {
|
|
3
|
+
/** The label shown for this crumb. */
|
|
4
|
+
label: ReactNode;
|
|
5
|
+
/** When provided the crumb renders as a link. */
|
|
6
|
+
href?: string;
|
|
7
|
+
/** onClick handler (use instead of href for SPA navigation). */
|
|
8
|
+
onClick?: () => void;
|
|
9
|
+
/** When true the crumb is shown but not clickable. */
|
|
10
|
+
disabled?: boolean;
|
|
11
|
+
}
|
|
12
|
+
export type BreadcrumbSeparator = 'slash' | 'chevron' | 'dot' | ReactElement;
|
|
13
|
+
export type BreadcrumbSize = 'xs' | 'sm' | 'md' | 'lg';
|
|
14
|
+
export interface BreadcrumbsProps {
|
|
15
|
+
/** The list of crumb items. The last item is treated as the current page. */
|
|
16
|
+
items: BreadcrumbItem[];
|
|
17
|
+
/** Separator between crumbs. Defaults to 'chevron'. */
|
|
18
|
+
separator?: BreadcrumbSeparator;
|
|
19
|
+
/** Text size. Defaults to 'sm'. */
|
|
20
|
+
size?: BreadcrumbSize;
|
|
21
|
+
/** When true collapses middle items into an ellipsis button. Defaults to false. */
|
|
22
|
+
collapsible?: boolean;
|
|
23
|
+
/** Maximum number of items to show when collapsible=true. Defaults to 4. */
|
|
24
|
+
maxItems?: number;
|
|
25
|
+
/** Additional class for the <nav> wrapper. */
|
|
26
|
+
className?: string;
|
|
27
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/react-vite';
|
|
2
|
+
import { Button } from './Button';
|
|
3
|
+
declare const meta: Meta<typeof Button>;
|
|
4
|
+
export default meta;
|
|
5
|
+
type Story = StoryObj<typeof Button>;
|
|
6
|
+
export declare const Primary: Story;
|
|
7
|
+
export declare const Secondary: Story;
|
|
8
|
+
export declare const Outline: Story;
|
|
9
|
+
export declare const Ghost: Story;
|
|
10
|
+
export declare const Danger: Story;
|
|
11
|
+
export declare const Success: Story;
|
|
12
|
+
export declare const Warning: Story;
|
|
13
|
+
export declare const Info: Story;
|
|
14
|
+
export declare const Loading: Story;
|
|
15
|
+
export declare const LoadingWithText: Story;
|
|
16
|
+
export declare const Disabled: Story;
|
|
17
|
+
export declare const WithIcons: Story;
|
|
18
|
+
export declare const FullWidth: Story;
|
|
19
|
+
export declare const Sizes: Story;
|
|
20
|
+
export declare const WithTooltip: Story;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { ButtonHTMLAttributes, ReactNode } from 'react';
|
|
2
|
+
import type { TooltipPlacement } from '../Tooltip/Tooltip.types';
|
|
3
|
+
export type ButtonVariant = 'primary' | 'secondary' | 'outline' | 'ghost' | 'danger' | 'success' | 'warning' | 'info';
|
|
4
|
+
export type ButtonSize = 'xs' | 'sm' | 'md' | 'lg' | 'xl';
|
|
5
|
+
export interface ButtonProps extends Omit<ButtonHTMLAttributes<HTMLButtonElement>, 'prefix'> {
|
|
6
|
+
/** The variant style of the button */
|
|
7
|
+
variant?: ButtonVariant;
|
|
8
|
+
/** The size of the button */
|
|
9
|
+
size?: ButtonSize;
|
|
10
|
+
/** Whether the button should take up the full width of its container */
|
|
11
|
+
fullWidth?: boolean;
|
|
12
|
+
/** Whether the button is currently in a loading state */
|
|
13
|
+
isLoading?: boolean;
|
|
14
|
+
/** Optional text to display alongside the spinner when loading */
|
|
15
|
+
loadingText?: string;
|
|
16
|
+
/** An icon element to display before the button content */
|
|
17
|
+
leftIcon?: ReactNode;
|
|
18
|
+
/** An icon element to display after the button content */
|
|
19
|
+
rightIcon?: ReactNode;
|
|
20
|
+
/** Optional tooltip text or element to display on hover */
|
|
21
|
+
tooltip?: ReactNode;
|
|
22
|
+
/** Preferred placement of the tooltip relative to the button */
|
|
23
|
+
tooltipPlacement?: TooltipPlacement;
|
|
24
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { CardProps, CardHeaderProps, CardTitleProps, CardDescriptionProps, CardContentProps, CardFooterProps } from './Card.types';
|
|
2
|
+
/**
|
|
3
|
+
* Root Card wrapper containing styles, border radiuses, and shadow mappings.
|
|
4
|
+
*/
|
|
5
|
+
export declare const Card: React.ForwardRefExoticComponent<CardProps & React.RefAttributes<HTMLDivElement>>;
|
|
6
|
+
/**
|
|
7
|
+
* Card Header segment, ideal for stacking Titles, actions, and meta data.
|
|
8
|
+
*/
|
|
9
|
+
export declare const CardHeader: React.ForwardRefExoticComponent<CardHeaderProps & React.RefAttributes<HTMLDivElement>>;
|
|
10
|
+
/**
|
|
11
|
+
* Semantically native Header 3 representation ensuring text harmony generically.
|
|
12
|
+
*/
|
|
13
|
+
export declare const CardTitle: React.ForwardRefExoticComponent<CardTitleProps & React.RefAttributes<HTMLHeadingElement>>;
|
|
14
|
+
/**
|
|
15
|
+
* Muted paragraph utility explicitly meant for text trailing a Title internally.
|
|
16
|
+
*/
|
|
17
|
+
export declare const CardDescription: React.ForwardRefExoticComponent<CardDescriptionProps & React.RefAttributes<HTMLParagraphElement>>;
|
|
18
|
+
/**
|
|
19
|
+
* Physical payload payload explicitly anchoring generic HTML spacing between a header and a footer correctly.
|
|
20
|
+
*/
|
|
21
|
+
export declare const CardContent: React.ForwardRefExoticComponent<CardContentProps & React.RefAttributes<HTMLDivElement>>;
|
|
22
|
+
/**
|
|
23
|
+
* Spaced flex container automatically injecting actions aligned horizontally below content natively.
|
|
24
|
+
*/
|
|
25
|
+
export declare const CardFooter: React.ForwardRefExoticComponent<CardFooterProps & React.RefAttributes<HTMLDivElement>>;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/react-vite';
|
|
2
|
+
import { Card } from './Card';
|
|
3
|
+
declare const meta: Meta<typeof Card>;
|
|
4
|
+
export default meta;
|
|
5
|
+
type Story = StoryObj<typeof Card>;
|
|
6
|
+
export declare const Basic: Story;
|
|
7
|
+
export declare const Variants: Story;
|
|
8
|
+
export declare const LoginExample: Story;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { HTMLAttributes } from 'react';
|
|
2
|
+
export type CardVariant = 'default' | 'outlined' | 'elevated' | 'filled';
|
|
3
|
+
export type CardPadding = 'none' | 'sm' | 'md' | 'lg' | 'xl';
|
|
4
|
+
export interface CardProps extends HTMLAttributes<HTMLDivElement> {
|
|
5
|
+
/** The overall visual style of the card */
|
|
6
|
+
variant?: CardVariant;
|
|
7
|
+
/** Internal padding scale to apply strictly to the overall wrapper */
|
|
8
|
+
padding?: CardPadding;
|
|
9
|
+
}
|
|
10
|
+
export type CardHeaderProps = HTMLAttributes<HTMLDivElement>;
|
|
11
|
+
export type CardTitleProps = HTMLAttributes<HTMLHeadingElement>;
|
|
12
|
+
export type CardDescriptionProps = HTMLAttributes<HTMLParagraphElement>;
|
|
13
|
+
export type CardContentProps = HTMLAttributes<HTMLDivElement>;
|
|
14
|
+
export type CardFooterProps = HTMLAttributes<HTMLDivElement>;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/react-vite';
|
|
2
|
+
import { Checkbox } from './Checkbox';
|
|
3
|
+
declare const meta: Meta<typeof Checkbox>;
|
|
4
|
+
export default meta;
|
|
5
|
+
type Story = StoryObj<typeof Checkbox>;
|
|
6
|
+
export declare const Basic: Story;
|
|
7
|
+
export declare const Checked: Story;
|
|
8
|
+
export declare const Indeterminate: Story;
|
|
9
|
+
export declare const Disabled: Story;
|
|
10
|
+
export declare const DisabledChecked: Story;
|
|
11
|
+
export declare const WithHelperText: Story;
|
|
12
|
+
export declare const ErrorState: Story;
|
|
13
|
+
export declare const SuccessState: Story;
|
|
14
|
+
export declare const WarningState: Story;
|
|
15
|
+
export declare const Sizes: Story;
|
|
16
|
+
export declare const IndeterminateController: Story;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import type { InputHTMLAttributes, ReactNode } from 'react';
|
|
2
|
+
export type CheckboxSize = 'xs' | 'sm' | 'md' | 'lg' | 'xl';
|
|
3
|
+
export type CheckboxState = 'default' | 'error' | 'success' | 'warning';
|
|
4
|
+
export interface CheckboxProps extends Omit<InputHTMLAttributes<HTMLInputElement>, 'size' | 'type'> {
|
|
5
|
+
/** The primary label to display next to the checkbox */
|
|
6
|
+
label?: ReactNode;
|
|
7
|
+
/** Additional helper text displayed beneath the checkbox */
|
|
8
|
+
helperText?: ReactNode;
|
|
9
|
+
/** Error message displayed beneath the checkbox when state is 'error' */
|
|
10
|
+
errorMessage?: ReactNode;
|
|
11
|
+
/** Success message displayed beneath the checkbox when state is 'success' */
|
|
12
|
+
successMessage?: ReactNode;
|
|
13
|
+
/** Warning message displayed beneath the checkbox when state is 'warning' */
|
|
14
|
+
warningMessage?: ReactNode;
|
|
15
|
+
/** The size of the checkbox and its associated text */
|
|
16
|
+
size?: CheckboxSize;
|
|
17
|
+
/** The validation state of the checkbox */
|
|
18
|
+
state?: CheckboxState;
|
|
19
|
+
/** Whether the checkbox represents a mixed or indeterminate state */
|
|
20
|
+
indeterminate?: boolean;
|
|
21
|
+
/** Custom class for the outermost container */
|
|
22
|
+
containerClassName?: string;
|
|
23
|
+
/** Alias for containerClassName to match other components */
|
|
24
|
+
wrapperClassName?: string;
|
|
25
|
+
/** Custom class for the underlying input element */
|
|
26
|
+
inputClassName?: string;
|
|
27
|
+
/** Custom class for the label element */
|
|
28
|
+
labelClassName?: string;
|
|
29
|
+
/** Custom class for the helper/message text element */
|
|
30
|
+
messageClassName?: string;
|
|
31
|
+
}
|