reactive-bulma 1.21.0 → 2.1.0

Sign up to get free protection for your applications and to get access to all the features.
package/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  MIT License
2
2
 
3
- Copyright (c) 2022 Nicolás Omar González Passerino
3
+ Copyright (c) 2023 Nicolás Omar González Passerino
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
package/README.md CHANGED
@@ -25,10 +25,12 @@ Component library based on React, Bulma, Typescript and Rollup
25
25
  - [Versioning](#versioning)
26
26
  - [Roadmap](#roadmap)
27
27
  - [Changelog](#changelog)
28
+ - [Contributing](#contributing)
28
29
  - [Credit](#credit)
29
30
  - [License](#license)
30
31
 
31
32
  ## Purpose
33
+
32
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.
33
35
 
34
36
  ## Status
@@ -47,6 +49,7 @@ After studying [an Udemy course about Typescript](https://github.com/NicolasOmar
47
49
  [![GitHub commit activity][badge-github-commits]][link-github-commit-activity]
48
50
  [![GitHub last commit][badge-github-last-commit]][link-github-commit-history]
49
51
  [![Semantic Commits][badge-semantic-commits]][link-semantic-commits]
52
+ [![Contributor Covenant][badge-code-of-conduct]][link-code-of-conduct]
50
53
 
51
54
  [badge-npm-version]: https://img.shields.io/github/package-json/v/nicolasomar/reactive-bulma?label=npm%20version&logo=npm&labelColor=535353&color=success&style=flat
52
55
  [badge-npm-size]: https://img.shields.io/bundlephobia/min/reactive-bulma?label=bundle%20size&labelColor=535353&logo=npm&style=flat
@@ -62,7 +65,7 @@ After studying [an Udemy course about Typescript](https://github.com/NicolasOmar
62
65
  [badge-soundcloud-security]: https://sonarcloud.io/api/project_badges/measure?project=NicolasOmar_reactive-bulma&metric=security_rating
63
66
  [badge-soundcloud-tech-debt]: https://sonarcloud.io/api/project_badges/measure?project=NicolasOmar_reactive-bulma&metric=sqale_index
64
67
  [link-soundcloud-status]: https://sonarcloud.io/summary/new_code?id=NicolasOmar_reactive-bulma
65
- [badge-snyk-status]: https://img.shields.io/snyk/vulnerabilities/github/nicolasomar/reactive-bulma?logo=snyk
68
+ [badge-snyk-status]: https://snyk.io/test/github/nicolasomar/reactive-bulma/badge.svg
66
69
  [link-snyk-status]: https://snyk.io/test/github/nicolasomar/reactive-bulma
67
70
  [badge-github-repo-stars]: https://img.shields.io/github/stars/nicolasomar/reactive-bulma?label=stars&logo=github&labelColor=535353&style=flat
68
71
  [badge-github-commits]: https://img.shields.io/github/commit-activity/m/nicolasomar/reactive-bulma?logo=github
@@ -72,6 +75,8 @@ After studying [an Udemy course about Typescript](https://github.com/NicolasOmar
72
75
  [link-github-commit-history]: https://github.com/NicolasOmar/reactive-bulma/commits/main
73
76
  [badge-semantic-commits]: https://img.shields.io/badge/using-conventional%20commits-e10079?logo=conventional-commits
74
77
  [link-semantic-commits]: https://github.com/semantic-release/semantic-release
78
+ [badge-code-of-conduct]: https://img.shields.io/badge/Contributor%20Covenant-2.1-4baaaa.svg
79
+ [link-code-of-conduct]: code_of_conduct.md
75
80
 
76
81
  ## Dependencies
77
82
 
@@ -138,6 +143,7 @@ Reactive bulma's documentation, included in this repo in the root directory, is
138
143
  Learn more about using `Storybook` by reading its [documentation](https://storybook.js.org/docs/react/get-started/install).
139
144
 
140
145
  ## Usage
146
+
141
147
  ```jsx
142
148
  import React from 'react'
143
149
  import { Button } from 'reactive-bulma'
@@ -193,6 +199,11 @@ In case you want the detailed list of current and future features, go to the [ro
193
199
 
194
200
  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.
195
201
 
202
+ ## Contributing
203
+
204
+ If you're interested in contributing to Reactive Bulma, please read [our contributing docs](./CONTRIBUTING.md) before submitting a pull request.
205
+
206
+
196
207
  ## Credit
197
208
 
198
209
  Bulma was beautifully crafted by [@jgthms](https://github.com/jgthms)
package/dist/cjs/index.js CHANGED
@@ -2862,7 +2862,7 @@ const parseTestId = (config) => {
2862
2862
  return `test-${config.tag}${fixedClassString.replace(/ /gm, (_a = config.separator) !== null && _a !== void 0 ? _a : '')}`;
2863
2863
  };
2864
2864
 
2865
- const Button = ({ testId = null, cssClasses = null, style = null, type = 'button', text = null, isDisabled = false, color = 'is-primary', isLightColor = false, isInvertedColor = false, isOutlined = false, isRounded = false, isLoading = false, isStatic = false, size = null, onClick = null }) => {
2865
+ const Button = ({ testId = null, cssClasses = null, style = null, type = 'button', text = null, isDisabled = false, color = null, isLightColor = false, isInvertedColor = false, isOutlined = false, isRounded = false, isLoading = false, isStatic = false, isSelected = false, size = null, onClick = null }) => {
2866
2866
  const buttonClasses = parseClasses([
2867
2867
  'button',
2868
2868
  color,
@@ -2872,6 +2872,7 @@ const Button = ({ testId = null, cssClasses = null, style = null, type = 'button
2872
2872
  isRounded ? 'is-rounded' : null,
2873
2873
  isLoading ? 'is-loading' : null,
2874
2874
  isStatic ? 'is-static' : null,
2875
+ isSelected ? 'is-selected' : null,
2875
2876
  size,
2876
2877
  cssClasses
2877
2878
  ]);
@@ -3172,9 +3173,40 @@ const RadioButton = ({ containerTestId = null, containerCssClasses = null, conta
3172
3173
  return (React.createElement("section", { "data-testid": radioButtonContainerTestId, className: radioButtonContainerClasses, style: containerStyle !== null && containerStyle !== void 0 ? containerStyle : undefined }, options.map((_option, i) => renderRadioButton(Object.assign(Object.assign({}, _option), { name, onChange: onChange !== null && onChange !== void 0 ? onChange : undefined }), i))));
3173
3174
  };
3174
3175
 
3176
+ const ButtonGroup = ({ testId = null, cssClasses = null, style = null, buttonList, isAttached = false, position = 'left' }) => {
3177
+ const buttonGroupClasses = parseClasses([
3178
+ 'buttons',
3179
+ isAttached ? 'has-addons' : null,
3180
+ !position || position === 'left' ? null : `is-${position}`,
3181
+ cssClasses
3182
+ ]);
3183
+ const buttonGroupTestId = testId !== null && testId !== void 0 ? testId : parseTestId({
3184
+ tag: 'buttons',
3185
+ parsedClasses: buttonGroupClasses,
3186
+ rules: [
3187
+ {
3188
+ regExp: /has-|is-/gm,
3189
+ replacer: '-'
3190
+ },
3191
+ {
3192
+ regExp: /buttons/gm,
3193
+ replacer: ''
3194
+ }
3195
+ ]
3196
+ });
3197
+ return (React.createElement("section", { "data-testid": buttonGroupTestId, className: buttonGroupClasses, style: style !== null && style !== void 0 ? style : undefined }, buttonList.map((currentButtonItem, i, originalButtonList) => {
3198
+ const hasSelectedButton = originalButtonList.some(({ isSelected }) => isSelected);
3199
+ const shouldApplyColor = (hasSelectedButton && currentButtonItem.isSelected) ||
3200
+ !hasSelectedButton;
3201
+ const buttonConfig = Object.assign(Object.assign({}, currentButtonItem), { color: shouldApplyColor ? currentButtonItem.color : undefined });
3202
+ return (React.createElement(Button, Object.assign({ key: `button-list-item-${i}` }, buttonConfig)));
3203
+ })));
3204
+ };
3205
+
3175
3206
  exports.Block = Block;
3176
3207
  exports.Box = Box;
3177
3208
  exports.Button = Button;
3209
+ exports.ButtonGroup = ButtonGroup;
3178
3210
  exports.Checkbox = CheckBox;
3179
3211
  exports.Column = Column;
3180
3212
  exports.Delete = Delete;