reactive-bulma 1.20.0 → 1.21.0
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/README.md +25 -20
- package/dist/cjs/index.js +161 -86
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/types/components/atoms/Checkbox/index.d.ts +3 -3
- package/dist/cjs/types/components/atoms/RadioButton/index.d.ts +4 -0
- package/dist/cjs/types/components/atoms/index.d.ts +2 -0
- package/dist/cjs/types/functions/parsers.d.ts +5 -5
- package/dist/cjs/types/interfaces/atomProps.d.ts +123 -9
- package/dist/cjs/types/interfaces/functionProps.d.ts +2 -2
- package/dist/esm/index.js +160 -87
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/types/components/atoms/Checkbox/index.d.ts +3 -3
- package/dist/esm/types/components/atoms/RadioButton/index.d.ts +4 -0
- package/dist/esm/types/components/atoms/index.d.ts +2 -0
- package/dist/esm/types/functions/parsers.d.ts +5 -5
- package/dist/esm/types/interfaces/atomProps.d.ts +123 -9
- package/dist/esm/types/interfaces/functionProps.d.ts +2 -2
- package/dist/index.d.ts +129 -9
- package/package.json +25 -25
@@ -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;
|
@@ -11,3 +11,5 @@ export { default as TextArea } from './TextArea';
|
|
11
11
|
export { default as Delete } from './Delete';
|
12
12
|
export { default as Select } from './Select';
|
13
13
|
export { default as File } from './File';
|
14
|
+
export { default as Checkbox } from './Checkbox';
|
15
|
+
export { default as RadioButton } from './RadioButton';
|
@@ -1,14 +1,14 @@
|
|
1
1
|
import { ParseTestIdProps } from '../interfaces/functionProps';
|
2
2
|
/**
|
3
|
-
* @param { Array<string | null> } _classes Required
|
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
|
-
* @param { string } config.tag Required
|
10
|
-
* @param { string } config.parsedClasses Required
|
11
|
-
* @param { {
|
9
|
+
* @param { string } config.tag `Required`. Component tag used between to build the final testId string.
|
10
|
+
* @param { string } config.parsedClasses `Required`. A single string of previously parsed classes what will be joined with `tag` property.
|
11
|
+
* @param { { regExp?: RegExp, replacer?: string }[] } config.rules Optional. An array of objects used with a regular expression to check each case and a replacer for each one, giving oportunity to handle specific cases of component class names.
|
12
12
|
* @returns A single string product of merge all classNames, separated by `separator` value
|
13
13
|
*/
|
14
14
|
export declare const parseTestId: (config: ParseTestIdProps) => 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,71 @@ 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
|
+
export interface RadioButtonItemProps extends Pick<BasicProps, 'testId' | 'style'> {
|
224
|
+
/** `Attribute` `Required` Sets checkbox's text*/
|
225
|
+
label: string;
|
226
|
+
/** `Attribute` Sets the name that will relate this checkbox with the others */
|
227
|
+
name?: string;
|
228
|
+
/** `Attribute` Shows the checkbox as checked or unchecked */
|
229
|
+
isChecked?: boolean;
|
230
|
+
/** `Attribute` Will disable the checkbox */
|
126
231
|
isDisabled?: boolean;
|
232
|
+
/** `Function` Click function, alone does not nothing, but can be reused for other components */
|
233
|
+
onChange?: () => void;
|
234
|
+
}
|
235
|
+
export interface RadioButtonProps extends BasicProps {
|
236
|
+
/** `Attribute` `Required` Indicates the options contained to be selected */
|
237
|
+
options: RadioButtonItemProps[];
|
238
|
+
/** `Attribute` `Required` Sets the name that will relate this checkbox with the others */
|
239
|
+
name: string;
|
240
|
+
/** `Function` Click function, alone does not nothing, but can be reused for other components */
|
127
241
|
onChange?: () => void;
|
128
242
|
}
|
129
243
|
export {};
|