techsbcn-storybook 2.0.2 → 2.0.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/README.md +140 -140
- package/dist/helpers/AuthHelper.d.ts +7 -0
- package/dist/helpers/index.d.ts +1 -0
- package/dist/index.js.map +1 -1
- package/dist/index.mjs.map +1 -1
- package/package.json +106 -106
package/README.md
CHANGED
|
@@ -1,140 +1,140 @@
|
|
|
1
|
-
# techsbcn-storybook
|
|
2
|
-
|
|
3
|
-
A React component library built by [TechsBCN](https://techsbcn.com) on top of Material UI. It provides a set of ready-to-use components — form fields, tables, layouts, navigation, modals and wrappers — designed to be consumed across internal projects with a consistent look and feel.
|
|
4
|
-
|
|
5
|
-
Components are developed and documented in [Storybook](https://storybook.js.org/) and shipped as an npm package.
|
|
6
|
-
|
|
7
|
-
## Requirements
|
|
8
|
-
|
|
9
|
-
- **Node.js** `>= 18`
|
|
10
|
-
- **React** `>= 18` (declared as a peer dependency)
|
|
11
|
-
- **Yarn** (the repository is pinned to Yarn 4 via `packageManager`)
|
|
12
|
-
|
|
13
|
-
## Installation
|
|
14
|
-
|
|
15
|
-
```bash
|
|
16
|
-
yarn add techsbcn-storybook
|
|
17
|
-
```
|
|
18
|
-
|
|
19
|
-
or
|
|
20
|
-
|
|
21
|
-
```bash
|
|
22
|
-
npm install techsbcn-storybook
|
|
23
|
-
```
|
|
24
|
-
|
|
25
|
-
Because MUI, Emotion, React Hook Form, Yup, i18next, dayjs and Font Awesome are runtime dependencies of this library, they are installed automatically.
|
|
26
|
-
|
|
27
|
-
## Usage
|
|
28
|
-
|
|
29
|
-
Import components directly from the package root:
|
|
30
|
-
|
|
31
|
-
```tsx
|
|
32
|
-
import { TextFieldComponent, ButtonComponent, TableComponent } from 'techsbcn-storybook';
|
|
33
|
-
|
|
34
|
-
export const Example = () => (
|
|
35
|
-
<>
|
|
36
|
-
<TextFieldComponent name="email" label="Email" />
|
|
37
|
-
<ButtonComponent onClick={() => console.log('clicked')}>Send</ButtonComponent>
|
|
38
|
-
</>
|
|
39
|
-
);
|
|
40
|
-
```
|
|
41
|
-
|
|
42
|
-
### Available component groups
|
|
43
|
-
|
|
44
|
-
| Group | Components |
|
|
45
|
-
| --- | --- |
|
|
46
|
-
| **Fields** | `ButtonComponent`, `TextFieldComponent`, `TextSimpleComponent`, `SelectField`, `SelectAsyncField`, `DatePickerComponent` |
|
|
47
|
-
| **Forms** | `LoginForm`, `ChangePasswordForm`, `ResetPasswordForm` |
|
|
48
|
-
| **Tables** | `TableComponent`, `SimpleTableComponent`, `SearchComponent` |
|
|
49
|
-
| **Layouts** | `MainLayoutSimple`, `AppHeader`, `AppSidebar`, `DrawerSidebar` |
|
|
50
|
-
| **Navigation** | `VerticalNav`, `UserInfo` |
|
|
51
|
-
| **Modals** | `ModalComponent` |
|
|
52
|
-
| **Wrappers** | `MainWrapperComponent`, `PublicFormWrapper`, `TabsComponent`, `LinearProgressComponent`, `CardComponent` |
|
|
53
|
-
|
|
54
|
-
See the Storybook documentation for the full API of each component.
|
|
55
|
-
|
|
56
|
-
## Development
|
|
57
|
-
|
|
58
|
-
### Getting started
|
|
59
|
-
|
|
60
|
-
```bash
|
|
61
|
-
yarn install
|
|
62
|
-
yarn storybook
|
|
63
|
-
```
|
|
64
|
-
|
|
65
|
-
Storybook runs on [http://localhost:6006](http://localhost:6006) and hot-reloads on changes inside `src/`.
|
|
66
|
-
|
|
67
|
-
### Project structure
|
|
68
|
-
|
|
69
|
-
```txt
|
|
70
|
-
src/
|
|
71
|
-
components/ # Library source — grouped by category
|
|
72
|
-
fields/
|
|
73
|
-
forms/
|
|
74
|
-
layouts/
|
|
75
|
-
modals/
|
|
76
|
-
navigation/
|
|
77
|
-
tables/
|
|
78
|
-
wrappers/
|
|
79
|
-
content/ # Static assets (images, icons) used by stories
|
|
80
|
-
data/ # Mock data and enums used only by stories
|
|
81
|
-
helpers/ # Shared utilities and hooks
|
|
82
|
-
interfaces/ # Shared TypeScript interfaces
|
|
83
|
-
stories/ # Storybook stories
|
|
84
|
-
i18n.tsx # Storybook-only i18n bootstrap
|
|
85
|
-
index.tsx # Public entry point (barrel of every exported component)
|
|
86
|
-
.storybook/ # Storybook configuration
|
|
87
|
-
tsup.config.ts # Build configuration (JS bundles)
|
|
88
|
-
tsconfig.build.json # Build configuration (type declarations)
|
|
89
|
-
```
|
|
90
|
-
|
|
91
|
-
Only files under `src/components/` are shipped in the published package. Stories, mock data and the Storybook i18n bootstrap are excluded from the build.
|
|
92
|
-
|
|
93
|
-
### Scripts
|
|
94
|
-
|
|
95
|
-
| Script | Description |
|
|
96
|
-
| --- | --- |
|
|
97
|
-
| `yarn start` | Runs `tsup` in watch mode (rebuilds `dist/` on every change) |
|
|
98
|
-
| `yarn build` | Produces the distributable output in `dist/`: CJS + ESM bundles, sourcemaps and type declarations |
|
|
99
|
-
| `yarn storybook` | Starts Storybook in development mode |
|
|
100
|
-
| `yarn build-storybook` | Builds the static Storybook site |
|
|
101
|
-
| `yarn lint` | Runs ESLint with autofix over the codebase |
|
|
102
|
-
| `yarn test` | Runs the Jest test suite |
|
|
103
|
-
| `yarn size` | Reports the bundle size using [size-limit](https://github.com/ai/size-limit) |
|
|
104
|
-
| `yarn analyze` | Opens the size-limit visual report |
|
|
105
|
-
|
|
106
|
-
## Build pipeline
|
|
107
|
-
|
|
108
|
-
The library is built in three steps, wired together in the `build` script:
|
|
109
|
-
|
|
110
|
-
1. **`tsup`** bundles `src/index.tsx` into CommonJS (`dist/index.js`) and ES Modules (`dist/index.mjs`) using esbuild, with SCSS compiled through `esbuild-sass-plugin` and static assets (SVG/PNG) emitted as separate files.
|
|
111
|
-
2. **`tsc -p tsconfig.build.json`** emits `.d.ts` declarations for the public API, excluding stories, tests, mock data and the Storybook i18n bootstrap.
|
|
112
|
-
3. **`node strip-asset-imports-dts.mjs`** post-processes the emitted declarations to remove side-effect imports of `.scss`, `.css`, `.svg` and `.png` files, so consumers do not need loaders for those assets.
|
|
113
|
-
|
|
114
|
-
## Tech stack
|
|
115
|
-
|
|
116
|
-
- **UI**: React 19, Material UI 9, Emotion, Font Awesome 7
|
|
117
|
-
- **Forms & validation**: React Hook Form 7, Yup 1, `@hookform/resolvers`
|
|
118
|
-
- **Dates**: `@mui/x-date-pickers`, `dayjs`
|
|
119
|
-
- **i18n**: `i18next`, `react-i18next`, `i18next-browser-languagedetector`
|
|
120
|
-
- **Routing (form components)**: `react-router` 8
|
|
121
|
-
- **Language & tooling**: TypeScript 6, ESLint 9 (flat config), Prettier 3, Jest 30, Storybook 10, tsup 8
|
|
122
|
-
|
|
123
|
-
## Publishing
|
|
124
|
-
|
|
125
|
-
The package is published to npm with only the `dist/` folder included (whitelisted through the `files` field in `package.json`). Before publishing, you can preview the tarball contents with:
|
|
126
|
-
|
|
127
|
-
```bash
|
|
128
|
-
npm pack --dry-run
|
|
129
|
-
```
|
|
130
|
-
|
|
131
|
-
To publish a new version:
|
|
132
|
-
|
|
133
|
-
```bash
|
|
134
|
-
yarn build
|
|
135
|
-
yarn npm publish
|
|
136
|
-
```
|
|
137
|
-
|
|
138
|
-
## License
|
|
139
|
-
|
|
140
|
-
[MIT](./LICENSE) © TechsBCN
|
|
1
|
+
# techsbcn-storybook
|
|
2
|
+
|
|
3
|
+
A React component library built by [TechsBCN](https://techsbcn.com) on top of Material UI. It provides a set of ready-to-use components — form fields, tables, layouts, navigation, modals and wrappers — designed to be consumed across internal projects with a consistent look and feel.
|
|
4
|
+
|
|
5
|
+
Components are developed and documented in [Storybook](https://storybook.js.org/) and shipped as an npm package.
|
|
6
|
+
|
|
7
|
+
## Requirements
|
|
8
|
+
|
|
9
|
+
- **Node.js** `>= 18`
|
|
10
|
+
- **React** `>= 18` (declared as a peer dependency)
|
|
11
|
+
- **Yarn** (the repository is pinned to Yarn 4 via `packageManager`)
|
|
12
|
+
|
|
13
|
+
## Installation
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
yarn add techsbcn-storybook
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
or
|
|
20
|
+
|
|
21
|
+
```bash
|
|
22
|
+
npm install techsbcn-storybook
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
Because MUI, Emotion, React Hook Form, Yup, i18next, dayjs and Font Awesome are runtime dependencies of this library, they are installed automatically.
|
|
26
|
+
|
|
27
|
+
## Usage
|
|
28
|
+
|
|
29
|
+
Import components directly from the package root:
|
|
30
|
+
|
|
31
|
+
```tsx
|
|
32
|
+
import { TextFieldComponent, ButtonComponent, TableComponent } from 'techsbcn-storybook';
|
|
33
|
+
|
|
34
|
+
export const Example = () => (
|
|
35
|
+
<>
|
|
36
|
+
<TextFieldComponent name="email" label="Email" />
|
|
37
|
+
<ButtonComponent onClick={() => console.log('clicked')}>Send</ButtonComponent>
|
|
38
|
+
</>
|
|
39
|
+
);
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
### Available component groups
|
|
43
|
+
|
|
44
|
+
| Group | Components |
|
|
45
|
+
| --- | --- |
|
|
46
|
+
| **Fields** | `ButtonComponent`, `TextFieldComponent`, `TextSimpleComponent`, `SelectField`, `SelectAsyncField`, `DatePickerComponent` |
|
|
47
|
+
| **Forms** | `LoginForm`, `ChangePasswordForm`, `ResetPasswordForm` |
|
|
48
|
+
| **Tables** | `TableComponent`, `SimpleTableComponent`, `SearchComponent` |
|
|
49
|
+
| **Layouts** | `MainLayoutSimple`, `AppHeader`, `AppSidebar`, `DrawerSidebar` |
|
|
50
|
+
| **Navigation** | `VerticalNav`, `UserInfo` |
|
|
51
|
+
| **Modals** | `ModalComponent` |
|
|
52
|
+
| **Wrappers** | `MainWrapperComponent`, `PublicFormWrapper`, `TabsComponent`, `LinearProgressComponent`, `CardComponent` |
|
|
53
|
+
|
|
54
|
+
See the Storybook documentation for the full API of each component.
|
|
55
|
+
|
|
56
|
+
## Development
|
|
57
|
+
|
|
58
|
+
### Getting started
|
|
59
|
+
|
|
60
|
+
```bash
|
|
61
|
+
yarn install
|
|
62
|
+
yarn storybook
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
Storybook runs on [http://localhost:6006](http://localhost:6006) and hot-reloads on changes inside `src/`.
|
|
66
|
+
|
|
67
|
+
### Project structure
|
|
68
|
+
|
|
69
|
+
```txt
|
|
70
|
+
src/
|
|
71
|
+
components/ # Library source — grouped by category
|
|
72
|
+
fields/
|
|
73
|
+
forms/
|
|
74
|
+
layouts/
|
|
75
|
+
modals/
|
|
76
|
+
navigation/
|
|
77
|
+
tables/
|
|
78
|
+
wrappers/
|
|
79
|
+
content/ # Static assets (images, icons) used by stories
|
|
80
|
+
data/ # Mock data and enums used only by stories
|
|
81
|
+
helpers/ # Shared utilities and hooks
|
|
82
|
+
interfaces/ # Shared TypeScript interfaces
|
|
83
|
+
stories/ # Storybook stories
|
|
84
|
+
i18n.tsx # Storybook-only i18n bootstrap
|
|
85
|
+
index.tsx # Public entry point (barrel of every exported component)
|
|
86
|
+
.storybook/ # Storybook configuration
|
|
87
|
+
tsup.config.ts # Build configuration (JS bundles)
|
|
88
|
+
tsconfig.build.json # Build configuration (type declarations)
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
Only files under `src/components/` are shipped in the published package. Stories, mock data and the Storybook i18n bootstrap are excluded from the build.
|
|
92
|
+
|
|
93
|
+
### Scripts
|
|
94
|
+
|
|
95
|
+
| Script | Description |
|
|
96
|
+
| --- | --- |
|
|
97
|
+
| `yarn start` | Runs `tsup` in watch mode (rebuilds `dist/` on every change) |
|
|
98
|
+
| `yarn build` | Produces the distributable output in `dist/`: CJS + ESM bundles, sourcemaps and type declarations |
|
|
99
|
+
| `yarn storybook` | Starts Storybook in development mode |
|
|
100
|
+
| `yarn build-storybook` | Builds the static Storybook site |
|
|
101
|
+
| `yarn lint` | Runs ESLint with autofix over the codebase |
|
|
102
|
+
| `yarn test` | Runs the Jest test suite |
|
|
103
|
+
| `yarn size` | Reports the bundle size using [size-limit](https://github.com/ai/size-limit) |
|
|
104
|
+
| `yarn analyze` | Opens the size-limit visual report |
|
|
105
|
+
|
|
106
|
+
## Build pipeline
|
|
107
|
+
|
|
108
|
+
The library is built in three steps, wired together in the `build` script:
|
|
109
|
+
|
|
110
|
+
1. **`tsup`** bundles `src/index.tsx` into CommonJS (`dist/index.js`) and ES Modules (`dist/index.mjs`) using esbuild, with SCSS compiled through `esbuild-sass-plugin` and static assets (SVG/PNG) emitted as separate files.
|
|
111
|
+
2. **`tsc -p tsconfig.build.json`** emits `.d.ts` declarations for the public API, excluding stories, tests, mock data and the Storybook i18n bootstrap.
|
|
112
|
+
3. **`node strip-asset-imports-dts.mjs`** post-processes the emitted declarations to remove side-effect imports of `.scss`, `.css`, `.svg` and `.png` files, so consumers do not need loaders for those assets.
|
|
113
|
+
|
|
114
|
+
## Tech stack
|
|
115
|
+
|
|
116
|
+
- **UI**: React 19, Material UI 9, Emotion, Font Awesome 7
|
|
117
|
+
- **Forms & validation**: React Hook Form 7, Yup 1, `@hookform/resolvers`
|
|
118
|
+
- **Dates**: `@mui/x-date-pickers`, `dayjs`
|
|
119
|
+
- **i18n**: `i18next`, `react-i18next`, `i18next-browser-languagedetector`
|
|
120
|
+
- **Routing (form components)**: `react-router` 8
|
|
121
|
+
- **Language & tooling**: TypeScript 6, ESLint 9 (flat config), Prettier 3, Jest 30, Storybook 10, tsup 8
|
|
122
|
+
|
|
123
|
+
## Publishing
|
|
124
|
+
|
|
125
|
+
The package is published to npm with only the `dist/` folder included (whitelisted through the `files` field in `package.json`). Before publishing, you can preview the tarball contents with:
|
|
126
|
+
|
|
127
|
+
```bash
|
|
128
|
+
npm pack --dry-run
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
To publish a new version:
|
|
132
|
+
|
|
133
|
+
```bash
|
|
134
|
+
yarn build
|
|
135
|
+
yarn npm publish
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
## License
|
|
139
|
+
|
|
140
|
+
[MIT](./LICENSE) © TechsBCN
|
package/dist/helpers/index.d.ts
CHANGED