reactive-bulma 2.0.0 → 2.1.0
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/cjs/index.js +33 -1
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/types/components/molecules/ButtonGroup/index.d.ts +4 -0
- package/dist/cjs/types/components/molecules/index.d.ts +1 -0
- package/dist/cjs/types/index.d.ts +1 -0
- package/dist/cjs/types/interfaces/atomProps.d.ts +3 -15
- package/dist/cjs/types/interfaces/commonProps.d.ts +33 -0
- package/dist/cjs/types/interfaces/moleculeProps.d.ts +10 -0
- package/dist/esm/index.js +33 -2
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/types/components/molecules/ButtonGroup/index.d.ts +4 -0
- package/dist/esm/types/components/molecules/index.d.ts +1 -0
- package/dist/esm/types/index.d.ts +1 -0
- package/dist/esm/types/interfaces/atomProps.d.ts +3 -15
- package/dist/esm/types/interfaces/commonProps.d.ts +33 -0
- package/dist/esm/types/interfaces/moleculeProps.d.ts +10 -0
- package/dist/index.d.ts +61 -38
- package/package.json +41 -41
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 =
|
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;
|