techsbcn-storybook 0.26.3 → 2.0.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 +1 -1
- package/README.md +92 -132
- package/dist/components/fields/ButtonComponent/ButtonComponent.d.ts +16 -16
- package/dist/components/fields/DatePickerComponent/DatePickerComponent.d.ts +26 -26
- package/dist/components/fields/SelectFieldComponent/SelectAsyncField.d.ts +28 -28
- package/dist/components/fields/SelectFieldComponent/SelectField.d.ts +29 -29
- package/dist/components/fields/TextFieldComponent/TextFieldComponent.d.ts +34 -34
- package/dist/components/fields/TextSimpleComponent/TextSimpleComponent.d.ts +32 -32
- package/dist/components/forms/ChangePasswordForm.d.ts +21 -21
- package/dist/components/forms/LoginForm.d.ts +20 -20
- package/dist/components/forms/ResetPasswordForm.d.ts +17 -17
- package/dist/components/layouts/DrawerLayout/DrawerSidebar/DrawerSidebar.d.ts +11 -11
- package/dist/components/layouts/MainLayoutSimple/MainLayoutSimple.d.ts +10 -10
- package/dist/components/layouts/Standard/AppHeader/AppHeader.d.ts +11 -11
- package/dist/components/layouts/Standard/AppSidebar/AppSidebar.d.ts +11 -11
- package/dist/components/modals/ModalComponent.d.ts +20 -20
- package/dist/components/navigation/VerticalNav/NavIcon.d.ts +7 -7
- package/dist/components/navigation/VerticalNav/VerticalNav.d.ts +23 -23
- package/dist/components/navigation/VerticalNav/VerticalNavItem.d.ts +9 -9
- package/dist/components/navigation/VerticalNav/VerticalNavItemCollapse.d.ts +9 -9
- package/dist/components/navigation/components/UserInfo.d.ts +12 -12
- package/dist/components/tables/ImageTableComponent/ImageTableComponent.d.ts +8 -8
- package/dist/components/tables/SearchComponent/SearchComponent.d.ts +26 -26
- package/dist/components/tables/SimpleTableComponent/SimpleTableComponent.d.ts +86 -86
- package/dist/components/tables/TableComponent/TableComponent.d.ts +89 -89
- package/dist/components/wrappers/CardComponent/CardComponent.d.ts +13 -13
- package/dist/components/wrappers/LinearProgressComponent/LinearProgressComponent.d.ts +3 -3
- package/dist/components/wrappers/MainWrapperComponent/MainWrapperComponent.d.ts +15 -15
- package/dist/components/wrappers/PublicFormWrapper/PublicFormWrapper.d.ts +8 -8
- package/dist/components/wrappers/TabsComponent/TabsComponent.d.ts +17 -17
- package/dist/helpers/CheckPermission.d.ts +1 -1
- package/dist/helpers/FileDownloader.d.ts +5 -5
- package/dist/helpers/GroupBy.d.ts +1 -1
- package/dist/helpers/hooks.d.ts +2 -3
- package/dist/helpers/index.d.ts +4 -4
- package/dist/index.d.ts +24 -24
- package/dist/index.js +2628 -5
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +2576 -0
- package/dist/index.mjs.map +1 -0
- package/dist/interfaces/index.d.ts +5 -6
- package/dist/interfaces/search/BasicEntity.d.ts +5 -5
- package/dist/interfaces/search/SearchFilters.d.ts +11 -11
- package/dist/interfaces/search/SearchResult.d.ts +4 -4
- package/dist/interfaces/search/SearchSimpleResult.d.ts +5 -5
- package/dist/interfaces/shared/ObjectKey.d.ts +3 -3
- package/package.json +68 -108
- package/dist/data/Routes.d.ts +0 -2
- package/dist/data/SelectMock.d.ts +0 -11
- package/dist/data/UserList.d.ts +0 -19
- package/dist/data/Values.d.ts +0 -2
- package/dist/data/_globalization/es.d.ts +0 -122
- package/dist/data/enums/ActiveStatus.d.ts +0 -4
- package/dist/data/enums/scopes.d.ts +0 -5
- package/dist/data/index.d.ts +0 -6
- package/dist/i18n.d.ts +0 -2
- package/dist/interfaces/file/File.d.ts +0 -7
- package/dist/stories/Fields/Fields.stories.d.ts +0 -6
- package/dist/stories/Fields/TextFieldComponent.stories.d.ts +0 -4
- package/dist/stories/Fields/TextSimpleComponent.stories.d.ts +0 -4
- package/dist/stories/Forms/Forms.stories.d.ts +0 -6
- package/dist/stories/Layouts/MainLayoutSimple.stories.d.ts +0 -6
- package/dist/stories/MainWrapper/MainWrapper.stories.d.ts +0 -4
- package/dist/stories/Modal/Modal.stories.d.ts +0 -4
- package/dist/stories/Tables/SimpleTable.stories.d.ts +0 -4
- package/dist/stories/Tables/TableComponent.stories.d.ts +0 -4
- package/dist/stories/Tables/Tables.stories.d.ts +0 -5
- package/dist/stories/Wrappers/Card.stories.d.ts +0 -4
- package/dist/stories/button/Button.stories.d.ts +0 -12
- package/dist/techsbcn-storybook.cjs.development.js +0 -3309
- package/dist/techsbcn-storybook.cjs.development.js.map +0 -1
- package/dist/techsbcn-storybook.cjs.production.min.js +0 -2
- package/dist/techsbcn-storybook.cjs.production.min.js.map +0 -1
- package/dist/techsbcn-storybook.esm.js +0 -3281
- package/dist/techsbcn-storybook.esm.js.map +0 -1
- package/src/components/fields/ButtonComponent/ButtonComponent.scss +0 -61
- package/src/components/fields/ButtonComponent/ButtonComponent.tsx +0 -45
- package/src/components/fields/DatePickerComponent/DatePickerComponent.scss +0 -51
- package/src/components/fields/DatePickerComponent/DatePickerComponent.tsx +0 -92
- package/src/components/fields/SelectFieldComponent/SelectAsyncField.tsx +0 -113
- package/src/components/fields/SelectFieldComponent/SelectField.scss +0 -99
- package/src/components/fields/SelectFieldComponent/SelectField.tsx +0 -80
- package/src/components/fields/TextFieldComponent/TextFieldComponent.scss +0 -54
- package/src/components/fields/TextFieldComponent/TextFieldComponent.tsx +0 -114
- package/src/components/fields/TextSimpleComponent/TextSimpleComponent.scss +0 -67
- package/src/components/fields/TextSimpleComponent/TextSimpleComponent.tsx +0 -123
- package/src/components/forms/ChangePasswordForm.tsx +0 -153
- package/src/components/forms/LoginForm.tsx +0 -125
- package/src/components/forms/ResetPasswordForm.tsx +0 -75
- package/src/components/layouts/DrawerLayout/DrawerSidebar/DrawerSidebar.scss +0 -7
- package/src/components/layouts/DrawerLayout/DrawerSidebar/DrawerSidebar.tsx +0 -36
- package/src/components/layouts/MainLayoutSimple/MainLayoutSimple.scss +0 -9
- package/src/components/layouts/MainLayoutSimple/MainLayoutSimple.tsx +0 -24
- package/src/components/layouts/Standard/AppHeader/AppHeader.scss +0 -17
- package/src/components/layouts/Standard/AppHeader/AppHeader.tsx +0 -37
- package/src/components/layouts/Standard/AppSidebar/AppSidebar.scss +0 -7
- package/src/components/layouts/Standard/AppSidebar/AppSidebar.tsx +0 -66
- package/src/components/modals/ModalComponent.tsx +0 -89
- package/src/components/navigation/VerticalNav/NavIcon.tsx +0 -20
- package/src/components/navigation/VerticalNav/VerticalNav.scss +0 -71
- package/src/components/navigation/VerticalNav/VerticalNav.tsx +0 -44
- package/src/components/navigation/VerticalNav/VerticalNavItem.tsx +0 -46
- package/src/components/navigation/VerticalNav/VerticalNavItemCollapse.tsx +0 -104
- package/src/components/navigation/components/UserInfo.scss +0 -5
- package/src/components/navigation/components/UserInfo.tsx +0 -51
- package/src/components/tables/ImageTableComponent/ImageTableComponent.tsx +0 -45
- package/src/components/tables/SearchComponent/SearchComponent.scss +0 -61
- package/src/components/tables/SearchComponent/SearchComponent.tsx +0 -168
- package/src/components/tables/SimpleTableComponent/SimpleTableComponent.scss +0 -188
- package/src/components/tables/SimpleTableComponent/SimpleTableComponent.tsx +0 -524
- package/src/components/tables/TableComponent/TableComponent.scss +0 -275
- package/src/components/tables/TableComponent/TableComponent.tsx +0 -606
- package/src/components/wrappers/CardComponent/CardComponent.scss +0 -23
- package/src/components/wrappers/CardComponent/CardComponent.tsx +0 -39
- package/src/components/wrappers/LinearProgressComponent/LinearProgressComponent.scss +0 -17
- package/src/components/wrappers/LinearProgressComponent/LinearProgressComponent.tsx +0 -12
- package/src/components/wrappers/MainWrapperComponent/MainWrapperComponent.scss +0 -38
- package/src/components/wrappers/MainWrapperComponent/MainWrapperComponent.tsx +0 -55
- package/src/components/wrappers/PublicFormWrapper/PublicFormWrapper.scss +0 -7
- package/src/components/wrappers/PublicFormWrapper/PublicFormWrapper.tsx +0 -26
- package/src/components/wrappers/TabsComponent/TabsComponent.scss +0 -22
- package/src/components/wrappers/TabsComponent/TabsComponent.tsx +0 -54
- package/src/content/fonts/feather.eot +0 -0
- package/src/content/fonts/feather.svg +0 -759
- package/src/content/fonts/feather.ttf +0 -0
- package/src/content/fonts/feather.woff +0 -0
- package/src/content/img/icon-logo-techsbcn.svg +0 -1
- package/src/content/img/logo.png +0 -0
- package/src/data/Routes.tsx +0 -6
- package/src/data/SelectMock.tsx +0 -79
- package/src/data/UserList.tsx +0 -119
- package/src/data/Values.tsx +0 -106
- package/src/data/_globalization/es.js +0 -121
- package/src/data/enums/ActiveStatus.tsx +0 -4
- package/src/data/enums/scopes.ts +0 -5
- package/src/data/index.ts +0 -6
- package/src/helpers/CheckPermission.tsx +0 -23
- package/src/helpers/FileDownloader.tsx +0 -34
- package/src/helpers/GroupBy.tsx +0 -6
- package/src/helpers/hooks.tsx +0 -22
- package/src/helpers/index.tsx +0 -4
- package/src/i18n.tsx +0 -24
- package/src/index.tsx +0 -24
- package/src/interfaces/file/File.tsx +0 -8
- package/src/interfaces/index.tsx +0 -6
- package/src/interfaces/search/BasicEntity.tsx +0 -6
- package/src/interfaces/search/SearchFilters.tsx +0 -19
- package/src/interfaces/search/SearchResult.tsx +0 -4
- package/src/interfaces/search/SearchSimpleResult.tsx +0 -5
- package/src/interfaces/shared/ObjectKey.tsx +0 -3
- package/src/stories/Fields/Fields.stories.tsx +0 -678
- package/src/stories/Fields/TextFieldComponent.stories.tsx +0 -55
- package/src/stories/Fields/TextSimpleComponent.stories.tsx +0 -58
- package/src/stories/Forms/Forms.stories.tsx +0 -89
- package/src/stories/Layouts/MainLayoutSimple.stories.tsx +0 -330
- package/src/stories/MainWrapper/MainWrapper.stories.tsx +0 -193
- package/src/stories/Modal/Modal.stories.tsx +0 -32
- package/src/stories/Tables/SimpleTable.stories.tsx +0 -113
- package/src/stories/Tables/TableComponent.stories.tsx +0 -116
- package/src/stories/Tables/Tables.stories.tsx +0 -311
- package/src/stories/Wrappers/Card.stories.tsx +0 -85
- package/src/stories/button/Button.stories.tsx +0 -80
- package/src/styles/Globals.scss +0 -137
package/LICENSE
CHANGED
package/README.md
CHANGED
|
@@ -1,180 +1,140 @@
|
|
|
1
|
-
#
|
|
1
|
+
# techsbcn-storybook
|
|
2
2
|
|
|
3
|
-
|
|
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
4
|
|
|
5
|
-
|
|
5
|
+
Components are developed and documented in [Storybook](https://storybook.js.org/) and shipped as an npm package.
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
## Requirements
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
- **Node.js** `>= 18`
|
|
10
|
+
- **React** `>= 18` (declared as a peer dependency)
|
|
11
|
+
- **Yarn** (the repository is pinned to Yarn 4 via `packageManager`)
|
|
10
12
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
The recommended workflow is to run TSDX in one terminal:
|
|
13
|
+
## Installation
|
|
14
14
|
|
|
15
15
|
```bash
|
|
16
|
-
|
|
16
|
+
yarn add techsbcn-storybook
|
|
17
17
|
```
|
|
18
18
|
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
Then run either Storybook or the example playground:
|
|
22
|
-
|
|
23
|
-
### Storybook
|
|
24
|
-
|
|
25
|
-
Run inside another terminal:
|
|
19
|
+
or
|
|
26
20
|
|
|
27
21
|
```bash
|
|
28
|
-
|
|
22
|
+
npm install techsbcn-storybook
|
|
29
23
|
```
|
|
30
24
|
|
|
31
|
-
|
|
25
|
+
Because MUI, Emotion, React Hook Form, Yup, i18next, dayjs and Font Awesome are runtime dependencies of this library, they are installed automatically.
|
|
32
26
|
|
|
33
|
-
|
|
27
|
+
## Usage
|
|
34
28
|
|
|
35
|
-
|
|
29
|
+
Import components directly from the package root:
|
|
36
30
|
|
|
37
|
-
|
|
31
|
+
```tsx
|
|
32
|
+
import { TextFieldComponent, ButtonComponent, TableComponent } from 'techsbcn-storybook';
|
|
38
33
|
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
34
|
+
export const Example = () => (
|
|
35
|
+
<>
|
|
36
|
+
<TextFieldComponent name="email" label="Email" />
|
|
37
|
+
<ButtonComponent onClick={() => console.log('clicked')}>Send</ButtonComponent>
|
|
38
|
+
</>
|
|
39
|
+
);
|
|
43
40
|
```
|
|
44
41
|
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
To do a one-off build, use `npm run build` or `yarn build`.
|
|
48
|
-
|
|
49
|
-
To run tests, use `npm test` or `yarn test`.
|
|
50
|
-
|
|
51
|
-
## Configuration
|
|
42
|
+
### Available component groups
|
|
52
43
|
|
|
53
|
-
|
|
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` |
|
|
54
53
|
|
|
55
|
-
|
|
54
|
+
See the Storybook documentation for the full API of each component.
|
|
56
55
|
|
|
57
|
-
|
|
56
|
+
## Development
|
|
58
57
|
|
|
59
|
-
###
|
|
58
|
+
### Getting started
|
|
60
59
|
|
|
61
|
-
|
|
60
|
+
```bash
|
|
61
|
+
yarn install
|
|
62
|
+
yarn storybook
|
|
63
|
+
```
|
|
62
64
|
|
|
63
|
-
|
|
65
|
+
Storybook runs on [http://localhost:6006](http://localhost:6006) and hot-reloads on changes inside `src/`.
|
|
64
66
|
|
|
65
|
-
|
|
67
|
+
### Project structure
|
|
66
68
|
|
|
67
69
|
```txt
|
|
68
|
-
/
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
/
|
|
74
|
-
|
|
75
|
-
/
|
|
76
|
-
|
|
77
|
-
/stories
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
.
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
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)
|
|
86
89
|
```
|
|
87
90
|
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
We do not set up `react-testing-library` for you yet, we welcome contributions and documentation on this.
|
|
91
|
-
|
|
92
|
-
### Rollup
|
|
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.
|
|
93
92
|
|
|
94
|
-
|
|
93
|
+
### Scripts
|
|
95
94
|
|
|
96
|
-
|
|
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 |
|
|
97
105
|
|
|
98
|
-
|
|
106
|
+
## Build pipeline
|
|
99
107
|
|
|
100
|
-
|
|
108
|
+
The library is built in three steps, wired together in the `build` script:
|
|
101
109
|
|
|
102
|
-
|
|
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.
|
|
103
113
|
|
|
104
|
-
|
|
114
|
+
## Tech stack
|
|
105
115
|
|
|
106
|
-
-
|
|
107
|
-
-
|
|
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-dom` 7
|
|
121
|
+
- **Language & tooling**: TypeScript 6, ESLint 9 (flat config), Prettier 3, Jest 30, Storybook 10, tsup 8
|
|
108
122
|
|
|
109
|
-
##
|
|
110
|
-
|
|
111
|
-
Please see the main `tsdx` [optimizations docs](https://github.com/palmerhq/tsdx#optimizations). In particular, know that you can take advantage of development-only optimizations:
|
|
112
|
-
|
|
113
|
-
```js
|
|
114
|
-
// ./types/index.d.ts
|
|
115
|
-
declare var __DEV__: boolean;
|
|
116
|
-
|
|
117
|
-
// inside your code...
|
|
118
|
-
if (__DEV__) {
|
|
119
|
-
}
|
|
120
|
-
```
|
|
123
|
+
## Publishing
|
|
121
124
|
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
## Module Formats
|
|
125
|
-
|
|
126
|
-
CJS, ESModules, and UMD module formats are supported.
|
|
127
|
-
|
|
128
|
-
The appropriate paths are configured in `package.json` and `dist/index.js` accordingly. Please report if any issues are found.
|
|
129
|
-
|
|
130
|
-
## Deploying the Example Playground
|
|
131
|
-
|
|
132
|
-
The Playground is just a simple [Parcel](https://parceljs.org) app, you can deploy it anywhere you would normally deploy that. Here are some guidelines for **manually** deploying with the Netlify CLI (`npm i -g netlify-cli`):
|
|
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:
|
|
133
126
|
|
|
134
127
|
```bash
|
|
135
|
-
|
|
136
|
-
npm run build # builds to dist
|
|
137
|
-
netlify deploy # deploy the dist folder
|
|
128
|
+
npm pack --dry-run
|
|
138
129
|
```
|
|
139
130
|
|
|
140
|
-
|
|
131
|
+
To publish a new version:
|
|
141
132
|
|
|
142
133
|
```bash
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
# directory to deploy: example/dist
|
|
146
|
-
# pick yes for netlify.toml
|
|
134
|
+
yarn build
|
|
135
|
+
yarn npm publish
|
|
147
136
|
```
|
|
148
137
|
|
|
149
|
-
##
|
|
150
|
-
|
|
151
|
-
Per Palmer Group guidelines, [always use named exports.](https://github.com/palmerhq/typescript#exports) Code split inside your React app instead of your React library.
|
|
152
|
-
|
|
153
|
-
## Including Styles
|
|
154
|
-
|
|
155
|
-
There are many ways to ship styles, including with CSS-in-JS. TSDX has no opinion on this, configure how you like.
|
|
156
|
-
|
|
157
|
-
For vanilla CSS, you can include it at the root directory and add it to the `files` section in your `package.json`, so that it can be imported separately by your users and run through their bundler's loader.
|
|
158
|
-
|
|
159
|
-
## Publishing to NPM
|
|
160
|
-
|
|
161
|
-
We recommend using [np](https://github.com/sindresorhus/np).
|
|
162
|
-
|
|
163
|
-
## Usage with Lerna
|
|
164
|
-
|
|
165
|
-
When creating a new package with TSDX within a project set up with Lerna, you might encounter a `Cannot resolve dependency` error when trying to run the `example` project. To fix that you will need to make changes to the `package.json` file _inside the `example` directory_.
|
|
166
|
-
|
|
167
|
-
The problem is that due to the nature of how dependencies are installed in Lerna projects, the aliases in the example project's `package.json` might not point to the right place, as those dependencies might have been installed in the root of your Lerna project.
|
|
168
|
-
|
|
169
|
-
Change the `alias` to point to where those packages are actually installed. This depends on the directory structure of your Lerna project, so the actual path might be different from the diff below.
|
|
170
|
-
|
|
171
|
-
```diff
|
|
172
|
-
"alias": {
|
|
173
|
-
- "react": "../node_modules/react",
|
|
174
|
-
- "react-dom": "../node_modules/react-dom"
|
|
175
|
-
+ "react": "../../../node_modules/react",
|
|
176
|
-
+ "react-dom": "../../../node_modules/react-dom"
|
|
177
|
-
},
|
|
178
|
-
```
|
|
138
|
+
## License
|
|
179
139
|
|
|
180
|
-
|
|
140
|
+
[MIT](./LICENSE) © TechsBCN
|
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
|
|
3
|
-
export interface ButtonComponentProps {
|
|
4
|
-
className?: string;
|
|
5
|
-
label?: any;
|
|
6
|
-
startIcon?: React.ReactNode;
|
|
7
|
-
endIcon?: React.ReactNode;
|
|
8
|
-
onClick?: () => void;
|
|
9
|
-
loading?: boolean;
|
|
10
|
-
form?: string;
|
|
11
|
-
type?: 'button' | 'submit' | 'reset';
|
|
12
|
-
disabled?: boolean;
|
|
13
|
-
component?: any;
|
|
14
|
-
reverseColors?: boolean;
|
|
15
|
-
}
|
|
16
|
-
export declare const ButtonComponent: React.FC<ButtonComponentProps>;
|
|
1
|
+
import React from 'react';
|
|
2
|
+
|
|
3
|
+
export interface ButtonComponentProps {
|
|
4
|
+
className?: string;
|
|
5
|
+
label?: any;
|
|
6
|
+
startIcon?: React.ReactNode;
|
|
7
|
+
endIcon?: React.ReactNode;
|
|
8
|
+
onClick?: () => void;
|
|
9
|
+
loading?: boolean;
|
|
10
|
+
form?: string;
|
|
11
|
+
type?: 'button' | 'submit' | 'reset';
|
|
12
|
+
disabled?: boolean;
|
|
13
|
+
component?: any;
|
|
14
|
+
reverseColors?: boolean;
|
|
15
|
+
}
|
|
16
|
+
export declare const ButtonComponent: React.FC<ButtonComponentProps>;
|
|
@@ -1,26 +1,26 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
|
|
3
|
-
import { Dayjs } from 'dayjs';
|
|
4
|
-
declare type CalendarPickerView = 'year' | 'day' | 'month';
|
|
5
|
-
export interface DatePickerComponentProps {
|
|
6
|
-
id?: string;
|
|
7
|
-
label?: string;
|
|
8
|
-
name?: string;
|
|
9
|
-
value?: string | Dayjs | null;
|
|
10
|
-
className?: string;
|
|
11
|
-
inputFormat?: string;
|
|
12
|
-
required?: boolean;
|
|
13
|
-
disabled?: boolean;
|
|
14
|
-
error?: boolean;
|
|
15
|
-
startIcon?: React.ReactNode;
|
|
16
|
-
fullWidth?: boolean;
|
|
17
|
-
helperText?: string;
|
|
18
|
-
inputRef?: React.Ref<any>;
|
|
19
|
-
onChange: (value: any,
|
|
20
|
-
noBorders?: boolean;
|
|
21
|
-
maxDate?: any;
|
|
22
|
-
minDate?: any;
|
|
23
|
-
views?: CalendarPickerView[];
|
|
24
|
-
}
|
|
25
|
-
export declare const DatePickerComponent: React.FC<DatePickerComponentProps>;
|
|
26
|
-
export {};
|
|
1
|
+
import React from 'react';
|
|
2
|
+
|
|
3
|
+
import { Dayjs } from 'dayjs';
|
|
4
|
+
declare type CalendarPickerView = 'year' | 'day' | 'month';
|
|
5
|
+
export interface DatePickerComponentProps {
|
|
6
|
+
id?: string;
|
|
7
|
+
label?: string;
|
|
8
|
+
name?: string;
|
|
9
|
+
value?: string | Dayjs | null;
|
|
10
|
+
className?: string;
|
|
11
|
+
inputFormat?: string;
|
|
12
|
+
required?: boolean;
|
|
13
|
+
disabled?: boolean;
|
|
14
|
+
error?: boolean;
|
|
15
|
+
startIcon?: React.ReactNode;
|
|
16
|
+
fullWidth?: boolean;
|
|
17
|
+
helperText?: string;
|
|
18
|
+
inputRef?: React.Ref<any>;
|
|
19
|
+
onChange: (value: any, context?: any) => void;
|
|
20
|
+
noBorders?: boolean;
|
|
21
|
+
maxDate?: any;
|
|
22
|
+
minDate?: any;
|
|
23
|
+
views?: CalendarPickerView[];
|
|
24
|
+
}
|
|
25
|
+
export declare const DatePickerComponent: React.FC<DatePickerComponentProps>;
|
|
26
|
+
export {};
|
|
@@ -1,28 +1,28 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { SearchFilters } from '../../../interfaces';
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
interface SelectAsyncFieldProps {
|
|
6
|
-
name: string;
|
|
7
|
-
placeholder?: string;
|
|
8
|
-
defaultOptions?: any[];
|
|
9
|
-
isMulti?: boolean;
|
|
10
|
-
className?: string;
|
|
11
|
-
disabled?: boolean;
|
|
12
|
-
onChange?: (value: any, name: string) => void;
|
|
13
|
-
onChangeValue?: (value: any) => void;
|
|
14
|
-
onChangeOption?: (value: any, label: string, extra?: any) => void;
|
|
15
|
-
searchPromise: (filters: SearchFilters) => Promise<any>;
|
|
16
|
-
invalid?: boolean;
|
|
17
|
-
isClearable?: boolean;
|
|
18
|
-
helperText?: string;
|
|
19
|
-
filters?: any;
|
|
20
|
-
inputRef?: React.Ref<any>;
|
|
21
|
-
label?: string;
|
|
22
|
-
menuPlacement?: MenuPlacement;
|
|
23
|
-
value?: any[];
|
|
24
|
-
getOptionLabel?: (option: any) => any;
|
|
25
|
-
noBorders?: boolean;
|
|
26
|
-
}
|
|
27
|
-
export declare const SelectAsyncField: React.FunctionComponent<SelectAsyncFieldProps>;
|
|
28
|
-
export {};
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { SearchFilters } from '../../../interfaces';
|
|
3
|
+
|
|
4
|
+
type MenuPlacement = 'bottom' | 'auto' | 'top';
|
|
5
|
+
interface SelectAsyncFieldProps {
|
|
6
|
+
name: string;
|
|
7
|
+
placeholder?: string;
|
|
8
|
+
defaultOptions?: any[];
|
|
9
|
+
isMulti?: boolean;
|
|
10
|
+
className?: string;
|
|
11
|
+
disabled?: boolean;
|
|
12
|
+
onChange?: (value: any, name: string) => void;
|
|
13
|
+
onChangeValue?: (value: any) => void;
|
|
14
|
+
onChangeOption?: (value: any, label: string, extra?: any) => void;
|
|
15
|
+
searchPromise: (filters: SearchFilters) => Promise<any>;
|
|
16
|
+
invalid?: boolean;
|
|
17
|
+
isClearable?: boolean;
|
|
18
|
+
helperText?: string;
|
|
19
|
+
filters?: any;
|
|
20
|
+
inputRef?: React.Ref<any>;
|
|
21
|
+
label?: string;
|
|
22
|
+
menuPlacement?: MenuPlacement;
|
|
23
|
+
value?: any[];
|
|
24
|
+
getOptionLabel?: (option: any) => any;
|
|
25
|
+
noBorders?: boolean;
|
|
26
|
+
}
|
|
27
|
+
export declare const SelectAsyncField: React.FunctionComponent<SelectAsyncFieldProps>;
|
|
28
|
+
export {};
|
|
@@ -1,29 +1,29 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
interface SelectFieldProps {
|
|
5
|
-
name: string;
|
|
6
|
-
placeholder?: string;
|
|
7
|
-
options: any[];
|
|
8
|
-
defaultOptions?: any[];
|
|
9
|
-
isMulti?: boolean;
|
|
10
|
-
className?: string;
|
|
11
|
-
disabled?: boolean;
|
|
12
|
-
onChange?: (value: any, name: string) => void;
|
|
13
|
-
onChangeValue?: (value: any) => void;
|
|
14
|
-
onChangeOption?: (option: any, name?: string) => void;
|
|
15
|
-
invalid?: boolean;
|
|
16
|
-
isClearable?: boolean;
|
|
17
|
-
helperText?: string;
|
|
18
|
-
isSearchable?: boolean;
|
|
19
|
-
inputRef?: React.Ref<any>;
|
|
20
|
-
label?: string;
|
|
21
|
-
menuPlacement?: MenuPlacement;
|
|
22
|
-
isLoading?: boolean;
|
|
23
|
-
value?: any[];
|
|
24
|
-
getOptionLabel?: (option: any) => any;
|
|
25
|
-
addExtraOption?: any;
|
|
26
|
-
noBorders?: boolean;
|
|
27
|
-
}
|
|
28
|
-
export declare const SelectField: React.FunctionComponent<SelectFieldProps>;
|
|
29
|
-
export {};
|
|
1
|
+
import React from 'react';
|
|
2
|
+
|
|
3
|
+
type MenuPlacement = 'bottom' | 'auto' | 'top';
|
|
4
|
+
interface SelectFieldProps {
|
|
5
|
+
name: string;
|
|
6
|
+
placeholder?: string;
|
|
7
|
+
options: any[];
|
|
8
|
+
defaultOptions?: any[];
|
|
9
|
+
isMulti?: boolean;
|
|
10
|
+
className?: string;
|
|
11
|
+
disabled?: boolean;
|
|
12
|
+
onChange?: (value: any, name: string) => void;
|
|
13
|
+
onChangeValue?: (value: any) => void;
|
|
14
|
+
onChangeOption?: (option: any, name?: string) => void;
|
|
15
|
+
invalid?: boolean;
|
|
16
|
+
isClearable?: boolean;
|
|
17
|
+
helperText?: string;
|
|
18
|
+
isSearchable?: boolean;
|
|
19
|
+
inputRef?: React.Ref<any>;
|
|
20
|
+
label?: string;
|
|
21
|
+
menuPlacement?: MenuPlacement;
|
|
22
|
+
isLoading?: boolean;
|
|
23
|
+
value?: any[];
|
|
24
|
+
getOptionLabel?: (option: any) => any;
|
|
25
|
+
addExtraOption?: any;
|
|
26
|
+
noBorders?: boolean;
|
|
27
|
+
}
|
|
28
|
+
export declare const SelectField: React.FunctionComponent<SelectFieldProps>;
|
|
29
|
+
export {};
|
|
@@ -1,34 +1,34 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { StandardTextFieldProps } from '@mui/material
|
|
3
|
-
|
|
4
|
-
export
|
|
5
|
-
export interface TextFieldComponentProps extends StandardTextFieldProps {
|
|
6
|
-
id?: string;
|
|
7
|
-
label?: string;
|
|
8
|
-
name?: string;
|
|
9
|
-
value?: string | number;
|
|
10
|
-
className?: string;
|
|
11
|
-
type?: InputType;
|
|
12
|
-
placeholder?: string;
|
|
13
|
-
required?: boolean;
|
|
14
|
-
disabled?: boolean;
|
|
15
|
-
minNumber?: number;
|
|
16
|
-
maxNumber?: number;
|
|
17
|
-
error?: boolean;
|
|
18
|
-
startIcon?: React.ReactNode;
|
|
19
|
-
endIcon?: React.ReactNode;
|
|
20
|
-
fullWidth?: boolean;
|
|
21
|
-
helperText?: string;
|
|
22
|
-
textFieldRef?: any;
|
|
23
|
-
inputRef?: React.Ref<any>;
|
|
24
|
-
autoComplete?: string;
|
|
25
|
-
multiline?: boolean;
|
|
26
|
-
rows?: number;
|
|
27
|
-
maxLength?: number;
|
|
28
|
-
defaultValue?: string | number;
|
|
29
|
-
onChange?: (event: React.ChangeEvent<HTMLInputElement>) => void;
|
|
30
|
-
onKeyUp?: (event: React.KeyboardEvent<HTMLInputElement>) => void;
|
|
31
|
-
step?: number | string;
|
|
32
|
-
noBorders?: boolean;
|
|
33
|
-
}
|
|
34
|
-
export declare const TextFieldComponent: React.FC<TextFieldComponentProps>;
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { StandardTextFieldProps } from '@mui/material';
|
|
3
|
+
|
|
4
|
+
export type InputType = 'button' | 'checkbox' | 'color' | 'date' | 'datetime-local' | 'email' | 'file' | 'hidden' | 'image' | 'month' | 'number' | 'password' | 'radio' | 'range' | 'reset' | 'search' | 'submit' | 'tel' | 'text' | 'time' | 'url' | 'week';
|
|
5
|
+
export interface TextFieldComponentProps extends StandardTextFieldProps {
|
|
6
|
+
id?: string;
|
|
7
|
+
label?: string;
|
|
8
|
+
name?: string;
|
|
9
|
+
value?: string | number;
|
|
10
|
+
className?: string;
|
|
11
|
+
type?: InputType;
|
|
12
|
+
placeholder?: string;
|
|
13
|
+
required?: boolean;
|
|
14
|
+
disabled?: boolean;
|
|
15
|
+
minNumber?: number;
|
|
16
|
+
maxNumber?: number;
|
|
17
|
+
error?: boolean;
|
|
18
|
+
startIcon?: React.ReactNode;
|
|
19
|
+
endIcon?: React.ReactNode;
|
|
20
|
+
fullWidth?: boolean;
|
|
21
|
+
helperText?: string;
|
|
22
|
+
textFieldRef?: any;
|
|
23
|
+
inputRef?: React.Ref<any>;
|
|
24
|
+
autoComplete?: string;
|
|
25
|
+
multiline?: boolean;
|
|
26
|
+
rows?: number;
|
|
27
|
+
maxLength?: number;
|
|
28
|
+
defaultValue?: string | number;
|
|
29
|
+
onChange?: (event: React.ChangeEvent<HTMLInputElement>) => void;
|
|
30
|
+
onKeyUp?: (event: React.KeyboardEvent<HTMLInputElement>) => void;
|
|
31
|
+
step?: number | string;
|
|
32
|
+
noBorders?: boolean;
|
|
33
|
+
}
|
|
34
|
+
export declare const TextFieldComponent: React.FC<TextFieldComponentProps>;
|
|
@@ -1,32 +1,32 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { BoxProps } from '@mui/material
|
|
3
|
-
|
|
4
|
-
interface TextSimpleComponentProps {
|
|
5
|
-
label?: any | string;
|
|
6
|
-
skeletonLabel?: boolean;
|
|
7
|
-
isFormLabel?: boolean;
|
|
8
|
-
value?: any;
|
|
9
|
-
classNameLabel?: string;
|
|
10
|
-
className?: string;
|
|
11
|
-
error?: boolean;
|
|
12
|
-
startIcon?: React.ReactNode;
|
|
13
|
-
endIcon?: React.ReactNode;
|
|
14
|
-
helperText?: string;
|
|
15
|
-
noBorders?: boolean;
|
|
16
|
-
fullWidth?: boolean;
|
|
17
|
-
noMargin?: boolean;
|
|
18
|
-
isLoading?: boolean;
|
|
19
|
-
skeletonValue?: SkeletonProps;
|
|
20
|
-
componentBoxProps?: BoxProps;
|
|
21
|
-
valueBoxProps?: BoxProps;
|
|
22
|
-
labelBoxProps?: BoxProps;
|
|
23
|
-
helperBoxProps?: BoxProps;
|
|
24
|
-
labelMargin?: boolean;
|
|
25
|
-
valueInCenter?: boolean;
|
|
26
|
-
}
|
|
27
|
-
interface SkeletonProps {
|
|
28
|
-
useSkeleton: boolean;
|
|
29
|
-
mineSkeleton?: any;
|
|
30
|
-
}
|
|
31
|
-
export declare const TextSimpleComponent: React.FC<TextSimpleComponentProps>;
|
|
32
|
-
export {};
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { BoxProps } from '@mui/material';
|
|
3
|
+
|
|
4
|
+
interface TextSimpleComponentProps {
|
|
5
|
+
label?: any | string;
|
|
6
|
+
skeletonLabel?: boolean;
|
|
7
|
+
isFormLabel?: boolean;
|
|
8
|
+
value?: any;
|
|
9
|
+
classNameLabel?: string;
|
|
10
|
+
className?: string;
|
|
11
|
+
error?: boolean;
|
|
12
|
+
startIcon?: React.ReactNode;
|
|
13
|
+
endIcon?: React.ReactNode;
|
|
14
|
+
helperText?: string;
|
|
15
|
+
noBorders?: boolean;
|
|
16
|
+
fullWidth?: boolean;
|
|
17
|
+
noMargin?: boolean;
|
|
18
|
+
isLoading?: boolean;
|
|
19
|
+
skeletonValue?: SkeletonProps;
|
|
20
|
+
componentBoxProps?: BoxProps;
|
|
21
|
+
valueBoxProps?: BoxProps;
|
|
22
|
+
labelBoxProps?: BoxProps;
|
|
23
|
+
helperBoxProps?: BoxProps;
|
|
24
|
+
labelMargin?: boolean;
|
|
25
|
+
valueInCenter?: boolean;
|
|
26
|
+
}
|
|
27
|
+
interface SkeletonProps {
|
|
28
|
+
useSkeleton: boolean;
|
|
29
|
+
mineSkeleton?: any;
|
|
30
|
+
}
|
|
31
|
+
export declare const TextSimpleComponent: React.FC<TextSimpleComponentProps>;
|
|
32
|
+
export {};
|