reactive-bulma 3.2.0 → 4.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (29) hide show
  1. package/README.md +37 -28
  2. package/dist/cjs/index.js +45 -0
  3. package/dist/cjs/index.js.map +1 -1
  4. package/dist/cjs/types/components/atoms/TableCell/index.d.ts +4 -0
  5. package/dist/cjs/types/components/atoms/TableHeadCell/index.d.ts +4 -0
  6. package/dist/cjs/types/components/atoms/index.d.ts +2 -0
  7. package/dist/cjs/types/components/molecules/TableRow/index.d.ts +4 -0
  8. package/dist/cjs/types/components/molecules/index.d.ts +1 -0
  9. package/dist/cjs/types/components/organisms/Table/index.d.ts +4 -0
  10. package/dist/cjs/types/components/organisms/index.d.ts +1 -0
  11. package/dist/cjs/types/functions/jest.d.ts +2 -0
  12. package/dist/cjs/types/interfaces/atomProps.d.ts +8 -0
  13. package/dist/cjs/types/interfaces/moleculeProps.d.ts +10 -2
  14. package/dist/cjs/types/interfaces/organismProps.d.ts +22 -2
  15. package/dist/esm/index.js +42 -1
  16. package/dist/esm/index.js.map +1 -1
  17. package/dist/esm/types/components/atoms/TableCell/index.d.ts +4 -0
  18. package/dist/esm/types/components/atoms/TableHeadCell/index.d.ts +4 -0
  19. package/dist/esm/types/components/atoms/index.d.ts +2 -0
  20. package/dist/esm/types/components/molecules/TableRow/index.d.ts +4 -0
  21. package/dist/esm/types/components/molecules/index.d.ts +1 -0
  22. package/dist/esm/types/components/organisms/Table/index.d.ts +4 -0
  23. package/dist/esm/types/components/organisms/index.d.ts +1 -0
  24. package/dist/esm/types/functions/jest.d.ts +2 -0
  25. package/dist/esm/types/interfaces/atomProps.d.ts +8 -0
  26. package/dist/esm/types/interfaces/moleculeProps.d.ts +10 -2
  27. package/dist/esm/types/interfaces/organismProps.d.ts +22 -2
  28. package/dist/index.d.ts +46 -2
  29. package/package.json +12 -12
package/README.md CHANGED
@@ -31,7 +31,12 @@ Component library based on React, Bulma, Typescript and Rollup
31
31
 
32
32
  ## Purpose
33
33
 
34
- After studying [an Udemy course about Typescript](https://github.com/NicolasOmar/typescript-practice), I wanted to start a new project to practice my new knowledge in a meaningful tool. Therefore, I started this project to understand how to create a component library and investigate the best ways to maintain and nourish it as any professional-level alternatives.
34
+ After studying [an Udemy course about Typescript](https://github.com/NicolasOmar/typescript-practice), I wanted to start a new project to practice my new knowledge in a meaningful tool. Therefore, I began this project to understand how to create a component library and investigate the best ways to maintain and nourish it as any professional-level alternatives.
35
+
36
+ Now I have finished (Jan 31th) [the last story](https://github.com/NicolasOmar/reactive-bulma/issues/80) related to my proposed roadmap; I will change the repo's objectives to the following:
37
+ - Check every new issues raised by users who found new bugs (of any kind) or related to new components or feature improvements of the existing ones.
38
+ - Update dependencies every week, creating alongside its related PR, branch, and PR to maintain track of those updates.
39
+ - Include ReactiveBulma's components as part of my full-stack app [MyPets](https://github.com/NicolasOmar/my-pets), where I now have code that I can get rid of and, in that process, find new opportunities to enhance components' usability.
35
40
 
36
41
  ## Status
37
42
 
@@ -119,15 +124,15 @@ After studying [an Udemy course about Typescript](https://github.com/NicolasOmar
119
124
 
120
125
  Several quick start options are available:
121
126
 
122
- - Clone the repo: `git clone https://github.com/NicolasOmar/reactive-bulma.git`
127
+ - Clone the repo: `git clone https://github.com/NicolasOmar/reactive-bulma.git`.
123
128
  - Install with [npm](https://www.npmjs.com/package/reactive-bulma): `npm install reactive-bulma@latest`
124
- - Before cloning this repo, I recommend installing [Node](https://nodejs.org/en/download/) `>=18` to install packages.
129
+ - Before cloning this repo, I recommend installing [Node](https://nodejs.org/en/download/) `>=20.10.0` to install packages.
125
130
 
126
131
  ## Folder structure
127
132
 
128
133
  In case you have cloned the repo, it will show you the following folders:
129
- - `_templates:` Dedicated to [Hygen](https://www.hygen.io/) configuration and implementation files. Dedicated to create new components from customizable templates
130
- - `.github:` [Github Actions](https://github.com/features/actions/) files used to run post-merge.commits like unit test coverage collection.
134
+ - `_templates:` Dedicated to [Hygen](https://www.hygen.io/) configuration and implementation files. Dedicated to creating new components from customizable templates.
135
+ - `.github:` [Github Actions](https://github.com/features/actions/) files used to run post-merge. commits like unit test coverage collection.
131
136
  - `.husky:` Dedicated to [Husky](https://typicode.github.io/husky/) configuration files.
132
137
  - `.storybook:` Dedicated to [Storybook](https://storybook.js.org/) configuration files.
133
138
  - `src:`
@@ -135,21 +140,21 @@ In case you have cloned the repo, it will show you the following folders:
135
140
  - `atoms` (from `v1.0.0`).
136
141
  - `molecules` (from `v2.0.0`).
137
142
  - `organisms` (from `v3.0.0`).
138
- - `design`: Location of common design tokens (coded on `.mdx` files) which are displayed above components sections in storybook's instance.
143
+ - `design`: Location of common design tokens (coded on `.mdx` files) displayed above components sections in the storybook's instance.
139
144
  - `functions`: Dedicated to parsers and helper functions for repetitive logic.
140
- - `interfaces`: Dedicated to interfaces used in components and functions typing.
141
- - `types`: Dedicated to Bulma's style type setting (which are part of component's properties).
145
+ - `interfaces`: Dedicated to components and functions typing interfaces.
146
+ - `types`: Dedicated to Bulma's style typesetting (part of the component's properties).
142
147
 
143
148
  ## Documentation
144
149
 
145
150
  Reactive bulma's documentation, included in this repo in the root directory, is built with [Storybook](https://storybook.js.org/) and publicly hosted on `Netlify` at <https://reactivebulma.netlify.app/>. The docs may also be run locally.
146
151
 
147
152
  ### Running documentation locally
148
- - Go to `reactive-bulma` folder (where you cloned the repo before).
153
+ - Go to the `reactive-bulma` folder (where you cloned the repo before).
149
154
  - Open a console and run `npm install` to install the Node.js dependencies, including Storybook (the site builder).
150
155
  - Run `npm start`.
151
156
  - Wait until a new tab opens with url <http://localhost:6006/> in your browser.
152
- - In case you want to initiate it on the background, you can run `npm run start:cli`.
157
+ - If you want to initiate it in the background, you can run `npm run start:cli.`
153
158
 
154
159
  Learn more about `Storybook` by reading its [documentation](https://storybook.js.org/docs/react/get-started/install).
155
160
 
@@ -163,9 +168,9 @@ const App = () => (
163
168
  <Button text="This is a test" />
164
169
  );
165
170
  ```
166
- To see all component's variants and its code snippets, go to [Documentation](#documentation) section.
171
+ To see all component variants and code snippets go to the [Documentation](#documentation) section.
167
172
 
168
- In case you want to create a custom component for your forked Reactive Bulma version, the easiest way is by running the creation script I made, which [instructions are here](#how-to-create-a-template-component).
173
+ If you want to create a custom component for your forked Reactive Bulma version, the easiest way is by running the creation script I made, which [instructions are here](#how-to-create-a-template-component).
169
174
 
170
175
  ### How to create a template component
171
176
 
@@ -174,33 +179,38 @@ After some time, I understood that creating component files is a repetitive and
174
179
  - Open a console and run `npm run create` in your console.
175
180
  - An will assistant will appear asking about how your component will be named. You can answer with text separated with spaces (` `), underscores (`_`), or hyphens (`-`)
176
181
  - Then, the assistant will ask in which folder you want to create it (based on its type following [Atomic Design hierarchy structure](https://atomicdesign.bradfrost.com/chapter-2/))
177
- - At last, the script should create all base files to reduce time and focus on custom implementation.
182
+ - Finally, the script should create all base files to reduce time and focus on custom implementation.
178
183
 
179
184
  Learn more about `Hygen` by reading its [documentation](https://www.hygen.io/docs/quick-start).
180
185
 
181
186
  ### How to update all dependencies
182
187
 
183
- In case you wanted to make your own fork, I recommend you to updated at least weekly using a custom command `npm run update`, which will run the following commands in order:
184
- - `update:deps`: Using a [npm-check-updates](https://www.npmjs.com/package/npm-check-updates) script, you will be able to choose which dependencies want to update to latest version
185
- - `update:doctor`: Will run a set of build and test checks in order to assure your update will not break any current build.
186
- - `update:storybook`: Will update storybook to lastest version (following its recommended command) followed for a build check (similar to update:doctor, but for storybook only)
188
+ In case you want to make your fork, I recommend you to update at least weekly using a custom command `npm run update`, which will run the following commands in order:
189
+ - `update:deps`: Using a [npm-check-updates](https://www.npmjs.com/package/npm-check-updates) script, you will be able to choose which dependencies want to update to the latest version
190
+ - `update:doctor`: Runs build and test checks to ensure your update will not break any current build.
191
+ - `update:storybook`: Updates storybook to the latest version (following its recommended command) followed for a build check (similar to update:doctor, but for Storybook only)
187
192
 
188
193
  ## Versioning
189
194
 
190
- After investigating [semantic-release documentation](https://semantic-release.gitbook.io/semantic-release/) (reffer to [#3](https://github.com/NicolasOmar/reactive-bulma/issues/3)) and having a problematic implementation, I decided to change version meaning for this project with the following:
191
- - Major versions (`1.0.0`, `2.0.0` and beyond) will reffer to milestones/version achievement.
192
- - Minor versions (`1.1.0`, `1.2.0` and so on) will reffer to branch/story completition.
193
- - Patch versions (`1.0.1`, `1.0.2` and so on) will reffer to bugfixes only.
195
+ After investigating [semantic-release documentation](https://semantic-release.gitbook.io/semantic-release/) (refer to [#3](https://github.com/NicolasOmar/reactive-bulma/issues/3)) and finishing the last version according to the original roadmap, I decided to give the following meaning to project's versions after `v4.0.0`:
196
+ - Major versions (`5.0.0`, `6.0.0` and beyond) will refer to milestones achievement and significant changes on existing components that will need extra attention before the update.
197
+ - Minor versions (`4.1.0`, `4.2.0`, and so on) will refer to new components or modifications of existing ones.
198
+ - Patch versions (`4.0.1`, `4.0.2`, and so on) will refer to bug fixes or weekly dependencies updates.
194
199
 
195
- In case you are interested in check current project's status, you can go to [Roadmap](#roadmap) section.
200
+ To check the current project's status, go to the [Roadmap](#roadmap) section.
196
201
 
197
202
  ### Branching
198
203
 
199
- Giving the mentioned release logic, `main` is the only static branch, and each developed feature or fix will have an unique branch with its PR and a merge commit following [semantic versioning](https://semver.org/) and [semantic commits](https://github.com/semantic-release/semantic-release#commit-message-format) specifications.
204
+ Given the mentioned release logic, `main` is the only static branch, and each developed feature or fix will have a unique branch with its PR and a merge commit following [semantic versioning](https://semver.org/) and [semantic commits](https://github.com/semantic-release/semantic-release#commit-message-format) specifications.
200
205
 
201
206
  ## Roadmap
202
207
 
203
- Having in mind the [versioning section](#versioning), repo's status in a glance can be observed in this table.
208
+ After finishing the last story related to `v4.0.0`, ReactiveBulma's current work is now focused on updating its dependencies in a weekly manner, as well as checking every issue or discussion raised by visitors who are interested in improving the project by proposing new ideas in shape of tickets or issues with its related PR.
209
+
210
+ In case you want actual short-term status, go to the [project board](https://github.com/users/NicolasOmar/projects/3) (powered by `GitHub Projects`).
211
+
212
+ <details>
213
+ <summary>Here is the status table I used to keep track of the worked milestones/versions.</summary>
204
214
 
205
215
  | Version | Progress | Open issues | Closed issues
206
216
  | :---: | :---: | :---: | :---: |
@@ -209,6 +219,9 @@ Having in mind the [versioning section](#versioning), repo's status in a glance
209
219
  | `v3.0.0` | ![v3.0.0, progress][badge-progress-300] | ![v3.0.0, open][badge-issues-open-300] | ![v3.0.0, closed][badge-issues-closed-300] |
210
220
  | `v4.0.0` | ![v4.0.0, progress][badge-progress-400] | ![v4.0.0, open][badge-issues-open-400] | ![v4.0.0, closed][badge-issues-closed-400] |
211
221
 
222
+ In case you want the detailed list of current and future features, go to the [roadmap document](https://docs.google.com/document/d/1kWX-dDTD-cQUeB_Vbu0K6xRvtHaSA38h76yQnhiCe9U).
223
+ </details>
224
+
212
225
  [badge-progress-100]: https://img.shields.io/github/milestones/progress-percent/nicolasomar/reactive-bulma/1?label=%20&style=flat&color=informational
213
226
  [badge-issues-open-100]: https://img.shields.io/github/milestones/issues-open/nicolasomar/reactive-bulma/1?label=%20&style=flat&color=orange
214
227
  [badge-issues-closed-100]: https://img.shields.io/github/milestones/issues-closed/nicolasomar/reactive-bulma/1?label=%20&style=flat&color=success
@@ -222,10 +235,6 @@ Having in mind the [versioning section](#versioning), repo's status in a glance
222
235
  [badge-issues-open-400]: https://img.shields.io/github/milestones/issues-open/nicolasomar/reactive-bulma/4?label=%20&style=flat&color=orange
223
236
  [badge-issues-closed-400]: https://img.shields.io/github/milestones/issues-closed/nicolasomar/reactive-bulma/4?label=%20&style=flat&color=success
224
237
 
225
- In case you want the short-term status, go to the [project board](https://github.com/users/NicolasOmar/projects/3) (powered by `GitHub Projects`).
226
-
227
- In case you want the detailed list of current and future features, go to the [roadmap document](https://docs.google.com/document/d/1kWX-dDTD-cQUeB_Vbu0K6xRvtHaSA38h76yQnhiCe9U).
228
-
229
238
  ## Changelog
230
239
 
231
240
  The [changelog](https://github.com/NicolasOmar/reactive-bulma/blob/main/CHANGELOG.md) (powered by `semantic-release`) is regularly updated to reflect what's changed in each new release.
package/dist/cjs/index.js CHANGED
@@ -3329,6 +3329,16 @@ const NavBarItem = ({ testId = null, cssClasses = null, style = null, children,
3329
3329
  return (React.createElement("a", { "data-testid": navBarItemTestId, className: navBarItemClasses, style: style !== null && style !== void 0 ? style : undefined, "aria-hidden": 'true', onClick: onClick !== null && onClick !== void 0 ? onClick : undefined }, children));
3330
3330
  };
3331
3331
 
3332
+ const TableHeadCell = ({ testId = null, cssClasses = null, style = null, content, onClick = null }) => {
3333
+ const tableHeadCellTestId = testId !== null && testId !== void 0 ? testId : parseTestId({ tag: 'table-head-cell', parsedClasses: cssClasses !== null && cssClasses !== void 0 ? cssClasses : '' });
3334
+ return (React.createElement("th", { "data-testid": tableHeadCellTestId, className: cssClasses !== null && cssClasses !== void 0 ? cssClasses : undefined, style: style !== null && style !== void 0 ? style : undefined, onClick: onClick !== null && onClick !== void 0 ? onClick : undefined }, content));
3335
+ };
3336
+
3337
+ const TableCell = ({ testId = null, cssClasses = null, style = null, content, onClick = null }) => {
3338
+ const tableCellTestId = testId !== null && testId !== void 0 ? testId : parseTestId({ tag: 'table-cell', parsedClasses: cssClasses !== null && cssClasses !== void 0 ? cssClasses : '' });
3339
+ return (React.createElement("td", { "data-testid": tableCellTestId, className: cssClasses !== null && cssClasses !== void 0 ? cssClasses : undefined, style: style !== null && style !== void 0 ? style : undefined, onClick: onClick !== null && onClick !== void 0 ? onClick : undefined }, content));
3340
+ };
3341
+
3332
3342
  const generateKey = (max = 5000, min = 1) => {
3333
3343
  max = Math.floor(max);
3334
3344
  min = Math.ceil(min);
@@ -3833,6 +3843,17 @@ const NavBarDropdown = ({ testId = null, containerTestId = null, cssClasses = nu
3833
3843
  React.createElement("section", { "data-testid": navBarDropdownTestId, className: navBarDropdownClasses, style: style !== null && style !== void 0 ? style : undefined }, items.map(renderDropdownItem))));
3834
3844
  };
3835
3845
 
3846
+ const TableRow = ({ testId = null, cssClasses = null, style = null, headCell = null, listOfCells, isSelected = false, onClick = null }) => {
3847
+ const tableRowClasses = parseClasses([
3848
+ isSelected ? 'is-selected' : null,
3849
+ cssClasses
3850
+ ]);
3851
+ const tableRowTestId = testId !== null && testId !== void 0 ? testId : parseTestId({ tag: 'table-row', parsedClasses: tableRowClasses });
3852
+ return (React.createElement("tr", { "data-testid": tableRowTestId, className: tableRowClasses, style: style !== null && style !== void 0 ? style : undefined, onClick: onClick !== null && onClick !== void 0 ? onClick : undefined },
3853
+ headCell ? React.createElement(TableHeadCell, Object.assign({}, headCell)) : null,
3854
+ listOfCells.map(_cellConfig => (React.createElement(TableCell, Object.assign({ key: `table-row-${generateKey()}` }, _cellConfig))))));
3855
+ };
3856
+
3836
3857
  const renderFieldLabel = (labelText) => labelText ? (React.createElement("label", { "data-testid": 'test-form-field-label', className: 'label' }, labelText)) : null;
3837
3858
  const renderFieldBody = (inputControlConfig, isGrouped) => {
3838
3859
  if (isGrouped) {
@@ -3979,6 +4000,26 @@ const Card = ({ testId = null, cssClasses = null, style = null, headerText = nul
3979
4000
  }))) : null));
3980
4001
  };
3981
4002
 
4003
+ /* eslint-disable react/prop-types */
4004
+ const renderTableSection = (sectionName, configData) => (React.createElement("tr", null, configData.map(_ItemConfig => (React.createElement(TableHeadCell, Object.assign({ key: `table-${sectionName}-item-${generateKey()}` }, _ItemConfig))))));
4005
+ const Table = ({ testId = null, cssClasses = null, style = null, head, body, foot = null, isBordered = false, isStriped = false, isNarrow = false, isHoverable = false, isFullwidth = false, isContained = false }) => {
4006
+ const tableClasses = parseClasses([
4007
+ 'table',
4008
+ isBordered ? 'is-bordered' : null,
4009
+ isStriped ? 'is-striped' : null,
4010
+ isNarrow ? 'is-narrow' : null,
4011
+ isHoverable ? 'is-hoverable' : null,
4012
+ isFullwidth ? 'is-fullwidth' : null,
4013
+ cssClasses
4014
+ ]);
4015
+ const tableTestId = testId !== null && testId !== void 0 ? testId : parseTestId({ tag: 'table', parsedClasses: tableClasses });
4016
+ const TableElement = () => (React.createElement("table", { "data-testid": tableTestId, className: tableClasses, style: style !== null && style !== void 0 ? style : undefined },
4017
+ React.createElement("thead", { "data-testid": `${tableTestId}-head` }, renderTableSection('head', head)),
4018
+ React.createElement("tbody", { "data-testid": `${tableTestId}-body` }, body.map(_bodyRowConfig => (React.createElement(TableRow, Object.assign({ key: `table-body-item-${generateKey()}` }, _bodyRowConfig))))),
4019
+ foot ? (React.createElement("tfoot", { "data-testid": `${tableTestId}-foot` }, renderTableSection('foot', foot))) : null));
4020
+ return isContained ? (React.createElement("section", { "data-testid": `${tableTestId}-container`, className: 'table-container' }, React.createElement(TableElement, null))) : (React.createElement(TableElement, null));
4021
+ };
4022
+
3982
4023
  exports.Block = Block;
3983
4024
  exports.Box = Box;
3984
4025
  exports.BreadcrumbItem = BreadcrumbItem;
@@ -4025,6 +4066,10 @@ exports.RadioButton = RadioButton;
4025
4066
  exports.Section = Section;
4026
4067
  exports.Select = Select;
4027
4068
  exports.TabItem = TabItem;
4069
+ exports.Table = Table;
4070
+ exports.TableCell = TableCell;
4071
+ exports.TableHeadCell = TableHeadCell;
4072
+ exports.TableRow = TableRow;
4028
4073
  exports.Tabs = Tabs;
4029
4074
  exports.Tag = Tag;
4030
4075
  exports.TextArea = TextArea;