reactive-bulma 1.20.0 → 1.20.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 +95 -67
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/types/components/atoms/Checkbox/index.d.ts +3 -3
- package/dist/cjs/types/functions/parsers.d.ts +1 -1
- package/dist/cjs/types/interfaces/atomProps.d.ts +113 -9
- package/dist/esm/index.js +95 -67
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/types/components/atoms/Checkbox/index.d.ts +3 -3
- package/dist/esm/types/functions/parsers.d.ts +1 -1
- package/dist/esm/types/interfaces/atomProps.d.ts +113 -9
- package/dist/index.d.ts +96 -8
- package/package.json +1 -1
@@ -1,4 +1,4 @@
|
|
1
1
|
import React from 'react';
|
2
|
-
import {
|
3
|
-
declare const
|
4
|
-
export default
|
2
|
+
import { CheckBoxProps } from '../../../interfaces/atomProps';
|
3
|
+
declare const CheckBox: React.FC<CheckBoxProps>;
|
4
|
+
export default CheckBox;
|
@@ -3,7 +3,7 @@ import { ParseTestIdProps } from '../interfaces/functionProps';
|
|
3
3
|
* @param { Array<string | null> } _classes Required. Array of classNames on `string` (or `null`) values
|
4
4
|
* @returns { string } A single string product of merge all classNames, separated by spaces
|
5
5
|
*/
|
6
|
-
export declare const parseClasses: (_classes: Array<string | null>) => string;
|
6
|
+
export declare const parseClasses: (_classes: Array<string | null | undefined>) => string;
|
7
7
|
/**
|
8
8
|
* @param { ParseTestIdProps } config Configuration object
|
9
9
|
* @param { string } config.tag Required. Component tag used between to build the final testId string.
|
@@ -2,96 +2,169 @@ import React from 'react';
|
|
2
2
|
import { basicColorType, columnOffsetType, columnSizeType, fixedImageSizeType, iconColorModeType, basicSizeType, textColorType, titleSizeType } from '../types/styleTypes';
|
3
3
|
import { inputTypes } from '../types/domTypes';
|
4
4
|
interface BasicProps {
|
5
|
+
/** `Attribute` ID used to locate the element in unit test suites (like Jest) */
|
5
6
|
testId?: string;
|
7
|
+
/** `Attribute` *For container case*. ID used to locate the element in unit test suites (like Jest) */
|
8
|
+
containerTestId?: string;
|
9
|
+
/** `Attribute` Custom CSS classes, applicable for specific scenarios */
|
10
|
+
cssClasses?: string;
|
11
|
+
/** `Attribute` *For container case*. Custom CSS classes, applicable for specific scenarios */
|
12
|
+
containerCssClasses?: string;
|
13
|
+
/** `Attribute` Custom styling applicable for specific scenarios */
|
6
14
|
style?: React.CSSProperties;
|
15
|
+
/** `Attribute` *For container case*. Custom styling applicable for specific scenarios */
|
16
|
+
containerStyle?: React.CSSProperties;
|
7
17
|
}
|
8
18
|
export interface ColumnProps extends BasicProps, React.ComponentPropsWithoutRef<'section'> {
|
19
|
+
/** `Attribute` Reffers to the component or array of components that will be shown inside the column */
|
20
|
+
children?: string | React.ReactElement | React.ReactElement[];
|
21
|
+
/** `Styling` Set column's size */
|
9
22
|
size?: columnSizeType;
|
23
|
+
/** `Styling` Set column's offset (moving it as you set its size */
|
10
24
|
offset?: columnOffsetType;
|
25
|
+
/** `Styling` Set if the column only will take the space it needs */
|
11
26
|
isNarrow?: boolean;
|
12
27
|
}
|
13
28
|
export interface ButtonProps extends BasicProps, React.ComponentPropsWithoutRef<'button'> {
|
29
|
+
/** `Attribute` The text will be shown in the `Button` */
|
14
30
|
text?: string;
|
15
|
-
|
31
|
+
/** `Attribute` Will disable the button */
|
32
|
+
isDisabled?: boolean;
|
33
|
+
/** `Styling` Color based on bulma's color tokens */
|
16
34
|
color?: basicColorType;
|
35
|
+
/** `Styling` Will adjust the selected color with a ligther style */
|
17
36
|
isLightColor?: boolean;
|
37
|
+
/** `Styling` Will invert button's colors (typography in color and background in white or black) */
|
18
38
|
isInvertedColor?: boolean;
|
39
|
+
/** `Styling` Similar to `isInvertedColor`, but button's border will be colored */
|
19
40
|
isOutlined?: boolean;
|
41
|
+
/** `Styling` Will add round borders to button's shape */
|
20
42
|
isRounded?: boolean;
|
43
|
+
/** `Styling` Will change `text` for a animated spinner, but will remain clickeable */
|
21
44
|
isLoading?: boolean;
|
22
|
-
isDisabled
|
45
|
+
/** `Styling` Similar to `isDisabled`, but will remove any color style */
|
23
46
|
isStatic?: boolean;
|
47
|
+
/** `Styling` Set button's size on bulma's size tokens */
|
24
48
|
size?: basicSizeType;
|
49
|
+
/** `Function` Click function, alone does not nothing, but can be reused for other components */
|
25
50
|
onClick?: () => void;
|
26
51
|
}
|
27
52
|
export interface ProgressBarProps extends BasicProps, React.ComponentPropsWithoutRef<'progress'> {
|
53
|
+
/** `Attribute` Sets colored bar at the level against `max` value (`100` by default) */
|
28
54
|
value?: number;
|
55
|
+
/** `Attribute` Sets the entire bar length comparing with current `value` */
|
29
56
|
max?: number;
|
30
|
-
|
57
|
+
/** `Styling` Color based on bulma's color tokens */
|
31
58
|
color?: basicColorType;
|
59
|
+
/** `Styling` Set progress bar's size */
|
32
60
|
size?: basicSizeType;
|
61
|
+
/** `Styling` Will change `value` for a animated loading */
|
33
62
|
isLoading?: boolean;
|
34
63
|
}
|
35
64
|
export interface BlockProps extends BasicProps, React.ComponentPropsWithoutRef<'section'> {
|
36
|
-
|
65
|
+
/** `Attribute` Reffers to the component or array of components that will be shown inside the block */
|
66
|
+
children?: string | React.ReactElement | React.ReactElement[];
|
37
67
|
}
|
38
68
|
export interface TagProps extends BasicProps, React.ComponentPropsWithoutRef<'span'> {
|
69
|
+
/** `Attribute` `Required` The text will be shown in the `Tag` */
|
39
70
|
text: string;
|
71
|
+
/** `Attribute` Will add a delete button (for both single or addon cases) */
|
72
|
+
withDelete?: boolean;
|
73
|
+
/** `Attribute` Will add a second tag element (that could have its own text, color and delete) */
|
74
|
+
withAddon?: boolean;
|
75
|
+
/** `Attribute` The text will be shown in the tag's addon */
|
76
|
+
addonText?: string;
|
77
|
+
/** `Styling` Color based on bulma's color tokens */
|
40
78
|
color?: basicColorType;
|
79
|
+
/** `Styling` Will adjust the selected color with a ligther style */
|
41
80
|
isLight?: boolean;
|
81
|
+
/** `Styling` Will add round borders to tag's shape */
|
42
82
|
isRounded?: boolean;
|
83
|
+
/** `Styling` Set tag's size */
|
43
84
|
size?: Exclude<basicSizeType, 'is-normal'>;
|
44
|
-
|
45
|
-
withAddon?: boolean;
|
46
|
-
addonText?: string;
|
85
|
+
/** `Styling` Color on tag's addon based on bulma's color tokens */
|
47
86
|
addonColor?: basicColorType;
|
87
|
+
/** `Function` Click function for `delete` option, alone does not nothing, but can be reused for other components */
|
48
88
|
onDeleteClick?: () => void;
|
49
89
|
}
|
50
90
|
export interface ImageProps extends BasicProps, React.ComponentPropsWithoutRef<'figure'> {
|
91
|
+
/** `Attribute` `Required` The image source that will be shown */
|
51
92
|
src: string;
|
93
|
+
/** `Styling` Will add round borders to image's shape */
|
52
94
|
fixedSize?: fixedImageSizeType;
|
95
|
+
/** `Styling` Sets image size based on one of fixed ratios/fixed sizes */
|
53
96
|
isRounded?: boolean;
|
54
97
|
}
|
55
98
|
export interface BoxProps extends BasicProps, React.ComponentPropsWithoutRef<'section'> {
|
99
|
+
/** `Attribute` Reffers to the component or array of components that will be shown inside the box */
|
100
|
+
children?: string | React.ReactElement | React.ReactElement[];
|
56
101
|
}
|
57
102
|
export interface TitleSectionProps extends BasicProps, React.ComponentPropsWithoutRef<'p'> {
|
103
|
+
/** `Attribute` Sets the text you want to show */
|
58
104
|
text: string;
|
105
|
+
/** `Styling` Set text size */
|
59
106
|
size?: titleSizeType;
|
60
|
-
|
107
|
+
/** `Styling` Set type of title (`title` at top, `subtitle` at below) */
|
108
|
+
type: 'title' | 'subtitle';
|
109
|
+
/** `Styling` Set text spacing at default or maximun length */
|
61
110
|
isSpaced?: boolean;
|
62
111
|
}
|
63
112
|
export interface TitleProps {
|
113
|
+
/** `Attribute` Main title configuration object */
|
64
114
|
main?: TitleSectionProps;
|
115
|
+
/** `Attribute` Subtitle title configuration object */
|
65
116
|
secondary?: TitleSectionProps;
|
66
117
|
}
|
67
118
|
export interface IconProps extends BasicProps {
|
119
|
+
/** `Attribute` `Required` Sets the icon key work based on [Material Design icon list](https://pictogrammers.com/library/mdi/) */
|
68
120
|
iconLabel: string;
|
121
|
+
/** `Attribute` Sets the text you want to show next to the icon */
|
69
122
|
text?: string;
|
123
|
+
/** `Styling` Color based on bulma's text color tokens */
|
70
124
|
color?: textColorType;
|
125
|
+
/** `Styling` Set icons's size */
|
71
126
|
size?: Exclude<basicSizeType, 'is-normal'>;
|
127
|
+
/** `Styling` Special usage in case you want to set as dark or light mode */
|
72
128
|
colorMode?: iconColorModeType;
|
129
|
+
/** `Styling` Animates the icon spinning 360° */
|
73
130
|
isSpinning?: boolean;
|
74
131
|
}
|
75
132
|
export interface InputProps extends BasicProps {
|
133
|
+
/** `Attribute` `Required` What type of input will be used */
|
76
134
|
type: inputTypes;
|
135
|
+
/** `Attribute` The value that will be shown on the input */
|
77
136
|
text?: string;
|
137
|
+
/** `Attribute` Will disable the input */
|
78
138
|
isDisabled?: boolean;
|
139
|
+
/** `Attribute` Will show the input as a normal one, but is not editable and has no shadow */
|
79
140
|
isReadonly?: boolean;
|
141
|
+
/** `Styling` Color based on bulma's text color tokens */
|
80
142
|
color?: basicColorType;
|
143
|
+
/** `Styling` Set input's size */
|
81
144
|
size?: basicSizeType;
|
145
|
+
/** `Styling` Will add round borders to input's shape */
|
82
146
|
isRounded?: boolean;
|
147
|
+
/** `Styling` Will add a specific border when the input is hovered by the user */
|
83
148
|
isHovered?: boolean;
|
149
|
+
/** `Styling` Will add a specific border when the input is focused by the user */
|
84
150
|
isFocused?: boolean;
|
151
|
+
/** `Function` Click function. Alone does not nothing, but can be reused for other components */
|
85
152
|
onClick?: () => void;
|
153
|
+
/** `Function` Reffers to each time the user press a key. Alone does not nothing, but can be reused for other components */
|
86
154
|
onChange?: () => void;
|
87
155
|
}
|
88
156
|
export interface TextAreaProps extends Omit<InputProps, 'isRounded' | 'type'> {
|
157
|
+
/** `Attribute` Text area's columns value that sets its width */
|
89
158
|
cols?: number;
|
159
|
+
/** `Attribute` Text area's rows value that sets its height */
|
90
160
|
rows?: number;
|
161
|
+
/** `Styling` Will disable characteristic sizable property by removing its control on bottom-right corner */
|
91
162
|
isFixedSize?: boolean;
|
92
163
|
}
|
93
164
|
export interface DeleteProps extends BasicProps {
|
165
|
+
/** `Styling` Set icons's size */
|
94
166
|
size?: Exclude<basicSizeType, 'is-normal'>;
|
167
|
+
/** `Function` Click function. Alone does not nothing, but can be reused for other components */
|
95
168
|
onClick?: () => void;
|
96
169
|
}
|
97
170
|
export interface SelectOption {
|
@@ -100,30 +173,61 @@ export interface SelectOption {
|
|
100
173
|
selected?: boolean;
|
101
174
|
}
|
102
175
|
export interface SelectProps extends BasicProps {
|
176
|
+
/** `Attribute` Indicates the options contained on the select */
|
103
177
|
options?: SelectOption[];
|
178
|
+
/** `Attribute` Indicates how many options will be shown at first glance (before looking for the whole list */
|
104
179
|
showOptions?: number;
|
180
|
+
/** `Attribute` Will allow multiple selection */
|
105
181
|
isMultiple?: boolean;
|
182
|
+
/** `Styling` Color based on bulma's color tokens */
|
106
183
|
color?: basicColorType;
|
184
|
+
/** `Styling` Set select's size */
|
107
185
|
size?: basicSizeType;
|
186
|
+
/** `Styling`Will add round borders to input's shape */
|
108
187
|
isRounded?: boolean;
|
188
|
+
/** `Styling`Will add a specific border when the input is hovered by the user */
|
109
189
|
isHovered?: boolean;
|
190
|
+
/** `Styling`Will add a specific border when the input is focused by the user */
|
110
191
|
isFocused?: boolean;
|
192
|
+
/** `Function` Click function. Alone does not nothing, but can be reused for other components */
|
111
193
|
onClick?: () => void;
|
112
194
|
}
|
113
195
|
export interface FileProps extends BasicProps {
|
196
|
+
/** `Attribute` The name of the file to be uploaded */
|
114
197
|
fileName?: string;
|
198
|
+
/** `Attribute` The icon displayed in file's button" */
|
115
199
|
uploadIcon?: IconProps;
|
200
|
+
/** `Attribute` The text displayed in file's button */
|
116
201
|
uploadText?: string;
|
202
|
+
/** `Styling` Changes button's position to its right */
|
117
203
|
buttonOnRight?: boolean;
|
204
|
+
/** `Styling` The whole container (button and file name) will occupy its parent container width */
|
118
205
|
isFullWidth?: boolean;
|
206
|
+
/** `Styling` Changes styling to a box style, making the button bigger and file name's position below the button */
|
119
207
|
isBoxed?: boolean;
|
208
|
+
/** `Styling` Color based on bulma's color tokens */
|
120
209
|
color?: basicColorType;
|
210
|
+
/** `Styling` Set button's size */
|
121
211
|
size?: basicSizeType;
|
212
|
+
/** `Function` Click function, alone does not nothing, but can be reused for other components */
|
122
213
|
onClick?: () => void;
|
123
214
|
}
|
124
|
-
export interface
|
215
|
+
export interface CheckBoxProps extends BasicProps {
|
216
|
+
/** `Attribute` Sets checkbox's text that will be shown next to its control */
|
125
217
|
content?: string | React.ReactElement;
|
218
|
+
/** `Attribute` Will disable the checkbox */
|
219
|
+
isDisabled?: boolean;
|
220
|
+
/** `Function` Click function, alone does not nothing, but can be reused for other components */
|
221
|
+
onChange?: () => void;
|
222
|
+
}
|
223
|
+
interface RadioButtonItemProps {
|
224
|
+
label: string;
|
225
|
+
name: string;
|
226
|
+
isChecked?: boolean;
|
126
227
|
isDisabled?: boolean;
|
228
|
+
}
|
229
|
+
export interface RadioButtonProps extends BasicProps {
|
230
|
+
options: RadioButtonItemProps[];
|
127
231
|
onChange?: () => void;
|
128
232
|
}
|
129
233
|
export {};
|
package/dist/esm/index.js
CHANGED
@@ -2860,7 +2860,7 @@ const parseTestId = (config) => {
|
|
2860
2860
|
return `test-${config.tag}${fixedClassString.replace(/ /gm, (_a = config.separator) !== null && _a !== void 0 ? _a : '')}`;
|
2861
2861
|
};
|
2862
2862
|
|
2863
|
-
const Button = ({
|
2863
|
+
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 }) => {
|
2864
2864
|
const buttonClasses = parseClasses([
|
2865
2865
|
'button',
|
2866
2866
|
color,
|
@@ -2870,72 +2870,88 @@ const Button = ({ text = null, type = 'button', testId = null, style = null, col
|
|
2870
2870
|
isRounded ? 'is-rounded' : null,
|
2871
2871
|
isLoading ? 'is-loading' : null,
|
2872
2872
|
isStatic ? 'is-static' : null,
|
2873
|
-
size
|
2873
|
+
size,
|
2874
|
+
cssClasses
|
2874
2875
|
]);
|
2875
|
-
const
|
2876
|
-
return (React.createElement("button", { "data-testid":
|
2876
|
+
const buttonTestId = testId !== null && testId !== void 0 ? testId : parseTestId({ tag: 'button', parsedClasses: buttonClasses });
|
2877
|
+
return (React.createElement("button", { "data-testid": buttonTestId, 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));
|
2877
2878
|
};
|
2878
2879
|
|
2879
|
-
const Column = ({ testId = null,
|
2880
|
+
const Column = ({ testId = null, cssClasses = null, style = null, children = null, size = null, offset = null, isNarrow = false }) => {
|
2880
2881
|
const columnClasses = parseClasses([
|
2881
2882
|
'column',
|
2882
2883
|
size,
|
2883
2884
|
offset,
|
2884
|
-
isNarrow ? 'is-narrow' : null
|
2885
|
+
isNarrow ? 'is-narrow' : null,
|
2886
|
+
cssClasses
|
2885
2887
|
]);
|
2886
|
-
const
|
2887
|
-
return (React.createElement("section", { "data-testid":
|
2888
|
+
const columnTestId = testId !== null && testId !== void 0 ? testId : parseTestId({ tag: 'column', parsedClasses: columnClasses });
|
2889
|
+
return (React.createElement("section", { "data-testid": columnTestId, className: columnClasses, style: style !== null && style !== void 0 ? style : undefined }, children));
|
2888
2890
|
};
|
2889
2891
|
|
2890
|
-
const ProgressBar = ({
|
2892
|
+
const ProgressBar = ({ testId = null, cssClasses = null, style = null, value = 0, max = 100, color = 'is-primary', size = null, isLoading = false }) => {
|
2891
2893
|
const fixedValue = value > max || value < 0 ? 0 : value;
|
2892
|
-
const progressClasses = parseClasses([
|
2893
|
-
|
2894
|
+
const progressClasses = parseClasses([
|
2895
|
+
'progress',
|
2896
|
+
color,
|
2897
|
+
size,
|
2898
|
+
cssClasses
|
2899
|
+
]);
|
2900
|
+
const progressTestId = testId !== null && testId !== void 0 ? testId : parseTestId({
|
2894
2901
|
tag: 'progress',
|
2895
2902
|
parsedClasses: progressClasses
|
2896
2903
|
});
|
2897
|
-
return (React.createElement("progress", { "data-testid":
|
2904
|
+
return (React.createElement("progress", { "data-testid": progressTestId, className: progressClasses, style: style !== null && style !== void 0 ? style : undefined, value: isLoading ? undefined : value, max: max }, `${isLoading ? 0 : fixedValue}%`));
|
2898
2905
|
};
|
2899
2906
|
|
2900
|
-
const Block = ({ testId = 'test-block', style = null, children = null }) => children ? (React.createElement("section", { "data-testid": testId, className:
|
2907
|
+
const Block = ({ testId = 'test-block', cssClasses = 'block', style = null, children = null }) => children ? (React.createElement("section", { "data-testid": testId, className: cssClasses, style: style !== null && style !== void 0 ? style : undefined }, children)) : null;
|
2901
2908
|
|
2902
|
-
const Tag = ({
|
2903
|
-
const
|
2909
|
+
const Tag = ({ testId = null, containerTestId = null, cssClasses = null, containerCssClasses = null, style = null, containerStyle = null, text, withDelete = false, withAddon = false, addonText = null, color = null, isLight = null, isRounded = null, size = null, addonColor = null, onDeleteClick = null }) => {
|
2910
|
+
const tagContainerClasses = parseClasses([
|
2911
|
+
'tags',
|
2912
|
+
'has-addons',
|
2913
|
+
size ? size.replace('is-', 'are-') : null,
|
2914
|
+
containerCssClasses
|
2915
|
+
]);
|
2904
2916
|
const tagClasses = parseClasses([
|
2905
2917
|
'tag',
|
2906
2918
|
color,
|
2907
2919
|
isLight && !withAddon ? 'is-light' : null,
|
2908
2920
|
isRounded && !withAddon ? 'is-rounded' : null,
|
2909
|
-
size
|
2910
|
-
|
2911
|
-
const tagsWrapperClasses = parseClasses([
|
2912
|
-
'tags',
|
2913
|
-
'has-addons',
|
2914
|
-
size ? size.replace('is-', 'are-') : null
|
2921
|
+
size,
|
2922
|
+
cssClasses
|
2915
2923
|
]);
|
2916
|
-
const
|
2917
|
-
const
|
2924
|
+
const tagAddonClasses = parseClasses(['tag', addonColor]);
|
2925
|
+
const tagLabel = withAddon ? 'tags' : 'tag';
|
2926
|
+
const tagTestId = testId !== null && testId !== void 0 ? testId : parseTestId({
|
2918
2927
|
tag: tagLabel,
|
2919
|
-
parsedClasses: withAddon ?
|
2928
|
+
parsedClasses: withAddon ? tagContainerClasses : tagClasses,
|
2920
2929
|
separator: withAddon ? '-' : ''
|
2921
2930
|
});
|
2922
|
-
|
2923
|
-
|
2924
|
-
|
2931
|
+
const tagContainerTestId = containerTestId !== null && containerTestId !== void 0 ? containerTestId : `${tagTestId}-container`;
|
2932
|
+
const tagDeleteTestId = `${tagTestId}-delete`;
|
2933
|
+
return withAddon ? (React.createElement("section", { "data-testid": tagContainerTestId, style: containerStyle !== null && containerStyle !== void 0 ? containerStyle : undefined, className: tagContainerClasses },
|
2934
|
+
React.createElement("span", { "data-testid": tagTestId, className: tagClasses }, text),
|
2935
|
+
withDelete ? (React.createElement("a", { "data-testid": tagDeleteTestId, className: 'tag is-delete', onClick: onDeleteClick !== null && onDeleteClick !== void 0 ? onDeleteClick : undefined })) : (React.createElement("span", { className: tagAddonClasses }, addonText)))) : (React.createElement("span", { "data-testid": tagTestId, style: style !== null && style !== void 0 ? style : undefined, className: tagClasses },
|
2925
2936
|
text,
|
2926
|
-
withDelete ? (React.createElement("button", { "data-testid":
|
2937
|
+
withDelete ? (React.createElement("button", { "data-testid": tagDeleteTestId, className: 'delete', onClick: onDeleteClick !== null && onDeleteClick !== void 0 ? onDeleteClick : undefined })) : null));
|
2927
2938
|
};
|
2928
2939
|
|
2929
|
-
const Box = ({ testId = 'test-box', style = null, children = null }) => children ? (React.createElement("section", { "data-testid": testId, className:
|
2940
|
+
const Box = ({ testId = 'test-box', cssClasses = 'box', style = null, children = null }) => children ? (React.createElement("section", { "data-testid": testId, className: cssClasses, style: style !== null && style !== void 0 ? style : undefined }, children)) : null;
|
2930
2941
|
|
2931
2942
|
const renderTitleSection = (section) => {
|
2932
|
-
var _a, _b
|
2943
|
+
var _a, _b;
|
2944
|
+
if (!section)
|
2945
|
+
return null;
|
2946
|
+
const { type, size, isSpaced, cssClasses } = section;
|
2933
2947
|
const sectionClasses = parseClasses([
|
2934
|
-
|
2935
|
-
|
2936
|
-
|
2948
|
+
type,
|
2949
|
+
size !== null && size !== void 0 ? size : null,
|
2950
|
+
type === 'title' && isSpaced ? 'is-spaced' : null,
|
2951
|
+
cssClasses
|
2937
2952
|
]);
|
2938
|
-
|
2953
|
+
const sectionTestId = (_a = section === null || section === void 0 ? void 0 : section.testId) !== null && _a !== void 0 ? _a : `${section === null || section === void 0 ? void 0 : section.type}-test`;
|
2954
|
+
return (React.createElement("p", { "data-testid": sectionTestId, className: sectionClasses, style: (_b = section === null || section === void 0 ? void 0 : section.style) !== null && _b !== void 0 ? _b : undefined }, section === null || section === void 0 ? void 0 : section.text));
|
2939
2955
|
};
|
2940
2956
|
const Title = ({ main, secondary }) => (React.createElement(React.Fragment, null,
|
2941
2957
|
renderTitleSection(main),
|
@@ -2963,16 +2979,22 @@ const generateIconContainer = (icon, color) => {
|
|
2963
2979
|
});
|
2964
2980
|
return (React.createElement("span", { "data-testid": containerTestId, className: containerClasses }, icon));
|
2965
2981
|
};
|
2966
|
-
const Icon = ({
|
2967
|
-
const
|
2982
|
+
const Icon = ({ testId = null, containerTestId = null, cssClasses = null, containerCssClasses = null, style = null, containerStyle = null, iconLabel, text = null, color = null, size = null, colorMode = null, isSpinning = false }) => {
|
2983
|
+
const iconContainerClasses = parseClasses([
|
2984
|
+
'icon',
|
2985
|
+
color,
|
2986
|
+
size,
|
2987
|
+
containerCssClasses
|
2988
|
+
]);
|
2968
2989
|
const iconClasses = parseClasses([
|
2969
2990
|
'mdi',
|
2970
2991
|
`mdi-${iconLabel}`,
|
2971
2992
|
colorMode ? `mdi-${colorMode}` : null,
|
2972
2993
|
isSpinning ? 'mdi-spin' : null,
|
2973
|
-
size ? `mdi-${IconSizeEnum[size]}px` : 'mdi-24px'
|
2994
|
+
size ? `mdi-${IconSizeEnum[size]}px` : 'mdi-24px',
|
2995
|
+
cssClasses
|
2974
2996
|
]);
|
2975
|
-
const
|
2997
|
+
const iconContainertestId = containerTestId !== null && containerTestId !== void 0 ? containerTestId : parseTestId({
|
2976
2998
|
tag: 'icon',
|
2977
2999
|
parsedClasses: iconClasses,
|
2978
3000
|
rules: [
|
@@ -2987,39 +3009,41 @@ const Icon = ({ iconLabel, testId = null, text = null, style = null, color = nul
|
|
2987
3009
|
],
|
2988
3010
|
separator: '-'
|
2989
3011
|
});
|
2990
|
-
const
|
2991
|
-
const iconComponent = (React.createElement("span", { "data-testid":
|
2992
|
-
React.createElement("i", { "data-testid":
|
3012
|
+
const iconTestId = testId !== null && testId !== void 0 ? testId : `${iconContainertestId}-i`;
|
3013
|
+
const iconComponent = (React.createElement("span", { "data-testid": iconContainertestId, className: iconContainerClasses, style: containerStyle !== null && containerStyle !== void 0 ? containerStyle : undefined },
|
3014
|
+
React.createElement("i", { "data-testid": iconTestId, className: iconClasses, style: style !== null && style !== void 0 ? style : undefined }),
|
2993
3015
|
text ? React.createElement("span", null, text) : null));
|
2994
3016
|
return text ? generateIconContainer(iconComponent, color) : iconComponent;
|
2995
3017
|
};
|
2996
3018
|
|
2997
|
-
const Input = ({ testId = null, type, text = null, isDisabled = false, isReadonly = false,
|
3019
|
+
const Input = ({ testId = null, cssClasses = null, style = null, type, text = null, isDisabled = false, isReadonly = false, color = null, size = null, isRounded = null, isHovered = null, isFocused = null, onClick = null, onChange = null }) => {
|
2998
3020
|
const inputClasses = parseClasses([
|
2999
3021
|
'input',
|
3000
3022
|
color,
|
3001
3023
|
size,
|
3002
3024
|
isRounded ? 'is-rounded' : null,
|
3003
3025
|
isHovered ? 'is-hovered' : null,
|
3004
|
-
isFocused ? 'is-focused' : null
|
3026
|
+
isFocused ? 'is-focused' : null,
|
3027
|
+
cssClasses
|
3005
3028
|
]);
|
3006
|
-
const
|
3029
|
+
const inputTestId = testId !== null && testId !== void 0 ? testId : parseTestId({
|
3007
3030
|
tag: 'input',
|
3008
3031
|
parsedClasses: inputClasses
|
3009
3032
|
});
|
3010
|
-
return (React.createElement("input", { "data-testid":
|
3033
|
+
return (React.createElement("input", { "data-testid": inputTestId, type: type, defaultValue: text !== null && text !== void 0 ? text : undefined, disabled: isDisabled, readOnly: isReadonly, className: inputClasses, style: style !== null && style !== void 0 ? style : undefined, onClick: onClick !== null && onClick !== void 0 ? onClick : undefined, onChange: onChange !== null && onChange !== void 0 ? onChange : undefined }));
|
3011
3034
|
};
|
3012
3035
|
|
3013
|
-
const TextArea = ({ testId = null, text = null, cols = null, rows = null, isDisabled = false, isReadonly = false, isFixedSize = false,
|
3036
|
+
const TextArea = ({ testId = null, cssClasses = null, style = null, text = null, cols = null, rows = null, isDisabled = false, isReadonly = false, isFixedSize = false, color = null, size = null, isHovered = null, isFocused = null, onClick = null, onChange = null }) => {
|
3014
3037
|
const textAreaClasses = parseClasses([
|
3015
3038
|
'textarea',
|
3016
3039
|
color,
|
3017
3040
|
size,
|
3018
3041
|
isHovered ? 'is-hovered' : null,
|
3019
3042
|
isFocused ? 'is-focused' : null,
|
3020
|
-
isFixedSize ? 'has-fixed-size' : null
|
3043
|
+
isFixedSize ? 'has-fixed-size' : null,
|
3044
|
+
cssClasses
|
3021
3045
|
]);
|
3022
|
-
const
|
3046
|
+
const textAreaTestId = testId !== null && testId !== void 0 ? testId : parseTestId({
|
3023
3047
|
tag: 'textarea',
|
3024
3048
|
parsedClasses: textAreaClasses,
|
3025
3049
|
rules: [
|
@@ -3033,49 +3057,52 @@ const TextArea = ({ testId = null, text = null, cols = null, rows = null, isDisa
|
|
3033
3057
|
}
|
3034
3058
|
]
|
3035
3059
|
});
|
3036
|
-
return (React.createElement("textarea", { "data-testid":
|
3060
|
+
return (React.createElement("textarea", { "data-testid": textAreaTestId, defaultValue: text !== null && text !== void 0 ? text : undefined, cols: cols !== null && cols !== void 0 ? cols : undefined, rows: rows !== null && rows !== void 0 ? rows : undefined, disabled: isDisabled, readOnly: isReadonly, className: textAreaClasses, style: style !== null && style !== void 0 ? style : undefined, onClick: onClick !== null && onClick !== void 0 ? onClick : undefined, onChange: onChange !== null && onChange !== void 0 ? onChange : undefined }));
|
3037
3061
|
};
|
3038
3062
|
|
3039
|
-
const Delete = ({ testId = null, style = null, size = null, onClick = null }) => {
|
3040
|
-
const deleteClasses = parseClasses(['delete', size]);
|
3041
|
-
const
|
3063
|
+
const Delete = ({ testId = null, cssClasses = null, style = null, size = null, onClick = null }) => {
|
3064
|
+
const deleteClasses = parseClasses(['delete', size, cssClasses]);
|
3065
|
+
const deleteTestId = testId !== null && testId !== void 0 ? testId : parseTestId({
|
3042
3066
|
tag: 'delete',
|
3043
3067
|
parsedClasses: deleteClasses
|
3044
3068
|
});
|
3045
|
-
return (React.createElement("button", { "data-testid":
|
3069
|
+
return (React.createElement("button", { "data-testid": deleteTestId, className: deleteClasses, style: style !== null && style !== void 0 ? style : undefined, onClick: onClick !== null && onClick !== void 0 ? onClick : undefined }));
|
3046
3070
|
};
|
3047
3071
|
|
3048
|
-
const Select = ({ testId = null,
|
3049
|
-
const
|
3072
|
+
const Select = ({ testId = null, containerTestId = null, cssClasses = null, containerCssClasses = null, style = null, containerStyle = null, options = [], showOptions = 1, isMultiple = false, color = null, size = null, isRounded = null, isHovered = null, isFocused = null, onClick = null }) => {
|
3073
|
+
const containerSelectClasses = parseClasses([
|
3050
3074
|
'select',
|
3051
3075
|
color,
|
3052
3076
|
size,
|
3053
3077
|
isMultiple ? 'is-multiple' : null,
|
3054
3078
|
isRounded ? 'is-rounded' : null,
|
3055
3079
|
isHovered ? 'is-hovered' : null,
|
3056
|
-
isFocused ? 'is-focused' : null
|
3080
|
+
isFocused ? 'is-focused' : null,
|
3081
|
+
containerCssClasses
|
3057
3082
|
]);
|
3058
3083
|
const selectTestId = testId !== null && testId !== void 0 ? testId : parseTestId({
|
3059
3084
|
tag: 'select',
|
3060
|
-
parsedClasses:
|
3085
|
+
parsedClasses: containerSelectClasses
|
3061
3086
|
});
|
3062
|
-
|
3063
|
-
|
3087
|
+
const containerSelectTestId = containerTestId !== null && containerTestId !== void 0 ? containerTestId : `${selectTestId}-container`;
|
3088
|
+
return (React.createElement("section", { "data-testid": containerSelectTestId, className: containerSelectClasses, style: containerStyle !== null && containerStyle !== void 0 ? containerStyle : undefined },
|
3089
|
+
React.createElement("select", { "data-testid": selectTestId, className: cssClasses !== null && cssClasses !== void 0 ? cssClasses : undefined, style: style !== null && style !== void 0 ? style : undefined, multiple: isMultiple, size: showOptions }, options.map(({ id, name, selected }, i) => (React.createElement("option", { "data-testid": `${selectTestId}-option-${i}`, key: id.toString(), selected: selected !== null && selected !== void 0 ? selected : false, onClick: onClick !== null && onClick !== void 0 ? onClick : undefined }, name))))));
|
3064
3090
|
};
|
3065
3091
|
|
3066
|
-
const File = ({ testId = null, fileName = null, uploadIcon = { iconLabel: 'upload' }, uploadText = 'Choose a file…',
|
3067
|
-
const
|
3092
|
+
const File = ({ testId = null, containerTestId = null, cssClasses = null, containerCssClasses = null, style = null, containerStyle = null, fileName = null, uploadIcon = { iconLabel: 'upload' }, uploadText = 'Choose a file…', buttonOnRight = false, isFullWidth = false, isBoxed = false, color = null, size = null, onClick = null }) => {
|
3093
|
+
const fileContainerClasses = parseClasses([
|
3068
3094
|
'file',
|
3069
3095
|
fileName ? 'has-name' : null,
|
3070
3096
|
buttonOnRight ? 'is-right' : null,
|
3071
3097
|
isFullWidth ? 'is-fullwidth' : null,
|
3072
3098
|
isBoxed ? 'is-boxed' : null,
|
3073
3099
|
color,
|
3074
|
-
size
|
3100
|
+
size,
|
3101
|
+
containerCssClasses
|
3075
3102
|
]);
|
3076
|
-
const
|
3103
|
+
const fileContainerTestId = containerTestId !== null && containerTestId !== void 0 ? containerTestId : parseTestId({
|
3077
3104
|
tag: 'file',
|
3078
|
-
parsedClasses:
|
3105
|
+
parsedClasses: fileContainerClasses,
|
3079
3106
|
rules: [
|
3080
3107
|
{
|
3081
3108
|
usedRegExp: /has/gm,
|
@@ -3087,10 +3114,11 @@ const File = ({ testId = null, fileName = null, uploadIcon = { iconLabel: 'uploa
|
|
3087
3114
|
}
|
3088
3115
|
]
|
3089
3116
|
});
|
3090
|
-
const
|
3091
|
-
|
3117
|
+
const fileInputClasses = cssClasses !== null && cssClasses !== void 0 ? cssClasses : 'file-input';
|
3118
|
+
const fileInputTestId = testId !== null && testId !== void 0 ? testId : `${fileContainerTestId}-input`;
|
3119
|
+
return (React.createElement("section", { "data-testid": fileContainerTestId, className: fileContainerClasses, style: containerStyle !== null && containerStyle !== void 0 ? containerStyle : undefined },
|
3092
3120
|
React.createElement("label", { className: 'file-label' },
|
3093
|
-
React.createElement("input", { "data-testid": fileInputTestId,
|
3121
|
+
React.createElement("input", { "data-testid": fileInputTestId, type: 'file', name: 'resume', className: fileInputClasses, style: style !== null && style !== void 0 ? style : undefined, onClick: onClick !== null && onClick !== void 0 ? onClick : undefined }),
|
3094
3122
|
React.createElement("span", { className: 'file-cta' },
|
3095
3123
|
uploadIcon ? React.createElement(Icon, Object.assign({}, uploadIcon)) : null,
|
3096
3124
|
React.createElement("span", { className: 'file-label' }, uploadText)),
|