reactive-bulma 1.9.0 → 1.10.1
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/dist/cjs/index.js +49 -8
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/types/components/atoms/Tag/index.d.ts +4 -0
- package/dist/cjs/types/components/atoms/index.d.ts +2 -0
- package/dist/cjs/types/functions/persers.d.ts +2 -0
- package/dist/cjs/types/interfaces/atomProps.d.ts +22 -5
- package/dist/cjs/types/interfaces/functionProps.d.ts +5 -0
- package/dist/esm/index.js +48 -9
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/types/components/atoms/Tag/index.d.ts +4 -0
- package/dist/esm/types/components/atoms/index.d.ts +2 -0
- package/dist/esm/types/functions/persers.d.ts +2 -0
- package/dist/esm/types/interfaces/atomProps.d.ts +22 -5
- package/dist/esm/types/interfaces/functionProps.d.ts +5 -0
- package/dist/index.d.ts +31 -9
- package/package.json +1 -1
@@ -1,11 +1,15 @@
|
|
1
|
-
|
1
|
+
import React from 'react';
|
2
2
|
import { basicColorType, columnOffsetType, columnSizeType, sizeType } from '../types/styleTypes';
|
3
|
-
|
3
|
+
interface BasicProps {
|
4
|
+
testId?: string;
|
5
|
+
style?: React.CSSProperties;
|
6
|
+
}
|
7
|
+
export interface ColumnProps extends BasicProps, React.ComponentPropsWithoutRef<'section'> {
|
4
8
|
size?: columnSizeType;
|
5
9
|
offset?: columnOffsetType;
|
6
10
|
isNarrow?: boolean;
|
7
11
|
}
|
8
|
-
export interface ButtonProps extends React.ComponentPropsWithoutRef<'button'> {
|
12
|
+
export interface ButtonProps extends BasicProps, React.ComponentPropsWithoutRef<'button'> {
|
9
13
|
text?: string;
|
10
14
|
style?: React.CSSProperties;
|
11
15
|
color?: basicColorType;
|
@@ -19,7 +23,7 @@ export interface ButtonProps extends React.ComponentPropsWithoutRef<'button'> {
|
|
19
23
|
size?: sizeType;
|
20
24
|
onClick?: () => void;
|
21
25
|
}
|
22
|
-
export interface ProgressBarProps extends React.ComponentPropsWithoutRef<'progress'> {
|
26
|
+
export interface ProgressBarProps extends BasicProps, React.ComponentPropsWithoutRef<'progress'> {
|
23
27
|
value?: number;
|
24
28
|
max?: number;
|
25
29
|
style?: React.CSSProperties;
|
@@ -27,6 +31,19 @@ export interface ProgressBarProps extends React.ComponentPropsWithoutRef<'progre
|
|
27
31
|
size?: sizeType;
|
28
32
|
isLoading?: boolean;
|
29
33
|
}
|
30
|
-
export interface BlockProps extends React.ComponentPropsWithoutRef<'section'> {
|
34
|
+
export interface BlockProps extends BasicProps, React.ComponentPropsWithoutRef<'section'> {
|
31
35
|
testId?: string;
|
32
36
|
}
|
37
|
+
export interface TagProps extends BasicProps, React.ComponentPropsWithoutRef<'span'> {
|
38
|
+
text: string;
|
39
|
+
color?: basicColorType;
|
40
|
+
isLight?: boolean;
|
41
|
+
isRounded?: boolean;
|
42
|
+
size?: Exclude<sizeType, 'is-normal'>;
|
43
|
+
withDelete?: boolean;
|
44
|
+
withAddon?: boolean;
|
45
|
+
addonText?: string;
|
46
|
+
addonColor?: basicColorType;
|
47
|
+
onDeleteClick?: () => void;
|
48
|
+
}
|
49
|
+
export {};
|
package/dist/esm/index.js
CHANGED
@@ -2839,8 +2839,12 @@ function requireReact_development () {
|
|
2839
2839
|
var React = /*@__PURE__*/getDefaultExportFromCjs(reactExports);
|
2840
2840
|
|
2841
2841
|
const parseClasses = (_classes) => _classes.filter(_class => _class).join(' ');
|
2842
|
+
const parseTestId = (config) => `test-${config.tag}${config.parsedClasses
|
2843
|
+
.replace(`${config.tag}`, '')
|
2844
|
+
.replace(/is-/gm, '-')
|
2845
|
+
.replace(/ /gm, config.separator || '')}`;
|
2842
2846
|
|
2843
|
-
const Button = ({ text = null, type = 'button', style = null, color = 'is-primary', isLightColor = false, isInvertedColor = false, isOutlined = false, isRounded = false, isLoading = false, isDisabled = false, isStatic = false, size = null, onClick = null }) => {
|
2847
|
+
const Button = ({ text = null, type = 'button', testId = null, style = null, color = 'is-primary', isLightColor = false, isInvertedColor = false, isOutlined = false, isRounded = false, isLoading = false, isDisabled = false, isStatic = false, size = null, onClick = null }) => {
|
2844
2848
|
const buttonClasses = parseClasses([
|
2845
2849
|
'button',
|
2846
2850
|
color,
|
@@ -2852,24 +2856,59 @@ const Button = ({ text = null, type = 'button', style = null, color = 'is-primar
|
|
2852
2856
|
isStatic ? 'is-static' : null,
|
2853
2857
|
size
|
2854
2858
|
]);
|
2855
|
-
|
2859
|
+
const _testId = testId !== null && testId !== void 0 ? testId : parseTestId({ tag: 'button', parsedClasses: buttonClasses });
|
2860
|
+
return (React.createElement("button", { "data-testid": _testId, type: type, className: buttonClasses, style: style !== null && style !== void 0 ? style : undefined, disabled: isDisabled !== null && isDisabled !== void 0 ? isDisabled : false, onClick: onClick !== null && onClick !== void 0 ? onClick : undefined }, text));
|
2856
2861
|
};
|
2857
2862
|
|
2858
|
-
const Column = ({ size = null, offset = null, isNarrow = false, children = null }) => {
|
2859
|
-
const
|
2863
|
+
const Column = ({ testId = null, style = null, size = null, offset = null, isNarrow = false, children = null }) => {
|
2864
|
+
const columnClasses = parseClasses([
|
2860
2865
|
'column',
|
2861
2866
|
size,
|
2862
2867
|
offset,
|
2863
2868
|
isNarrow ? 'is-narrow' : null
|
2864
2869
|
]);
|
2865
|
-
|
2870
|
+
const _testId = testId !== null && testId !== void 0 ? testId : parseTestId({ tag: 'column', parsedClasses: columnClasses });
|
2871
|
+
return (React.createElement("section", { "data-testid": _testId, className: columnClasses, style: style || undefined }, children));
|
2866
2872
|
};
|
2867
2873
|
|
2868
|
-
const ProgressBar = ({ value = 0, max = 100, style = null, color = 'is-primary', size = null, isLoading = false }) => {
|
2869
|
-
const progressClasses = parseClasses(['progress', color, size]);
|
2874
|
+
const ProgressBar = ({ value = 0, max = 100, testId = null, style = null, color = 'is-primary', size = null, isLoading = false }) => {
|
2870
2875
|
const fixedValue = value > max || value < 0 ? 0 : value;
|
2871
|
-
|
2876
|
+
const progressClasses = parseClasses(['progress', color, size]);
|
2877
|
+
const _testId = testId !== null && testId !== void 0 ? testId : parseTestId({
|
2878
|
+
tag: 'progress',
|
2879
|
+
parsedClasses: progressClasses
|
2880
|
+
});
|
2881
|
+
return (React.createElement("progress", { "data-testid": _testId, className: progressClasses, style: style !== null && style !== void 0 ? style : undefined, value: isLoading ? undefined : value, max: max }, `${isLoading ? 0 : fixedValue}%`));
|
2882
|
+
};
|
2883
|
+
|
2884
|
+
const Block = ({ testId = 'test-block', style = null, children = null }) => children ? (React.createElement("section", { "data-testid": testId, className: 'block', style: style || undefined }, children)) : null;
|
2885
|
+
|
2886
|
+
const Tag = ({ text, testId = null, style = null, color = null, isLight = null, isRounded = null, size = null, withDelete = false, withAddon = false, addonText = null, addonColor = null, onDeleteClick = null }) => {
|
2887
|
+
const tagLabel = withAddon ? 'tags' : 'tag';
|
2888
|
+
const tagClasses = parseClasses([
|
2889
|
+
'tag',
|
2890
|
+
color,
|
2891
|
+
isLight && !withAddon ? 'is-light' : null,
|
2892
|
+
isRounded && !withAddon ? 'is-rounded' : null,
|
2893
|
+
size
|
2894
|
+
]);
|
2895
|
+
const tagsWrapperClasses = parseClasses([
|
2896
|
+
'tags',
|
2897
|
+
'has-addons',
|
2898
|
+
size ? size.replace('is-', 'are-') : null
|
2899
|
+
]);
|
2900
|
+
const addonTagClasses = parseClasses(['tag', addonColor]);
|
2901
|
+
const _testId = testId !== null && testId !== void 0 ? testId : parseTestId({
|
2902
|
+
tag: tagLabel,
|
2903
|
+
parsedClasses: withAddon ? tagsWrapperClasses : tagClasses,
|
2904
|
+
separator: withAddon ? '-' : ''
|
2905
|
+
});
|
2906
|
+
return withAddon ? (React.createElement("section", { "data-testid": _testId, style: style || undefined, className: tagsWrapperClasses },
|
2907
|
+
React.createElement("span", { className: tagClasses }, text),
|
2908
|
+
withDelete ? (React.createElement("a", { "data-testid": `${_testId}-delete`, className: 'tag is-delete', onClick: onDeleteClick || undefined })) : (React.createElement("span", { className: addonTagClasses }, addonText)))) : (React.createElement("span", { "data-testid": _testId, style: style || undefined, className: tagClasses },
|
2909
|
+
text,
|
2910
|
+
withDelete ? (React.createElement("button", { "data-testid": `${_testId}-delete`, className: 'delete', onClick: onDeleteClick || undefined })) : null));
|
2872
2911
|
};
|
2873
2912
|
|
2874
|
-
export { Button, Column, ProgressBar };
|
2913
|
+
export { Block, Button, Column, ProgressBar, Tag };
|
2875
2914
|
//# sourceMappingURL=index.js.map
|