reactive-bulma 1.19.0 → 1.20.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,4 @@
1
+ import React from 'react';
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
- style?: React.CSSProperties;
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?: boolean;
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
- style?: React.CSSProperties;
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
- testId?: string;
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
- withDelete?: boolean;
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
- prop: 'title' | 'subtitle';
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,25 +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
  }
215
+ export interface CheckBoxProps extends BasicProps {
216
+ /** `Attribute` Sets checkbox's text that will be shown next to its control */
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;
227
+ isDisabled?: boolean;
228
+ }
229
+ export interface RadioButtonProps extends BasicProps {
230
+ options: RadioButtonItemProps[];
231
+ onChange?: () => void;
232
+ }
124
233
  export {};
package/dist/index.d.ts CHANGED
@@ -11,91 +11,161 @@ type iconColorModeType = 'light' | 'dark';
11
11
  type inputTypes = 'text' | 'password' | 'email' | 'tel';
12
12
 
13
13
  interface BasicProps {
14
+ /** `Attribute` ID used to locate the element in unit test suites (like Jest) */
14
15
  testId?: string;
16
+ /** `Attribute` *For container case*. ID used to locate the element in unit test suites (like Jest) */
17
+ containerTestId?: string;
18
+ /** `Attribute` Custom CSS classes, applicable for specific scenarios */
19
+ cssClasses?: string;
20
+ /** `Attribute` *For container case*. Custom CSS classes, applicable for specific scenarios */
21
+ containerCssClasses?: string;
22
+ /** `Attribute` Custom styling applicable for specific scenarios */
15
23
  style?: React.CSSProperties;
24
+ /** `Attribute` *For container case*. Custom styling applicable for specific scenarios */
25
+ containerStyle?: React.CSSProperties;
16
26
  }
17
27
  interface ColumnProps extends BasicProps, React.ComponentPropsWithoutRef<'section'> {
28
+ /** `Attribute` Reffers to the component or array of components that will be shown inside the column */
29
+ children?: string | React.ReactElement | React.ReactElement[];
30
+ /** `Styling` Set column's size */
18
31
  size?: columnSizeType;
32
+ /** `Styling` Set column's offset (moving it as you set its size */
19
33
  offset?: columnOffsetType;
34
+ /** `Styling` Set if the column only will take the space it needs */
20
35
  isNarrow?: boolean;
21
36
  }
22
37
  interface ButtonProps extends BasicProps, React.ComponentPropsWithoutRef<'button'> {
38
+ /** `Attribute` The text will be shown in the `Button` */
23
39
  text?: string;
24
- style?: React.CSSProperties;
40
+ /** `Attribute` Will disable the button */
41
+ isDisabled?: boolean;
42
+ /** `Styling` Color based on bulma's color tokens */
25
43
  color?: basicColorType;
44
+ /** `Styling` Will adjust the selected color with a ligther style */
26
45
  isLightColor?: boolean;
46
+ /** `Styling` Will invert button's colors (typography in color and background in white or black) */
27
47
  isInvertedColor?: boolean;
48
+ /** `Styling` Similar to `isInvertedColor`, but button's border will be colored */
28
49
  isOutlined?: boolean;
50
+ /** `Styling` Will add round borders to button's shape */
29
51
  isRounded?: boolean;
52
+ /** `Styling` Will change `text` for a animated spinner, but will remain clickeable */
30
53
  isLoading?: boolean;
31
- isDisabled?: boolean;
54
+ /** `Styling` Similar to `isDisabled`, but will remove any color style */
32
55
  isStatic?: boolean;
56
+ /** `Styling` Set button's size on bulma's size tokens */
33
57
  size?: basicSizeType;
58
+ /** `Function` Click function, alone does not nothing, but can be reused for other components */
34
59
  onClick?: () => void;
35
60
  }
36
61
  interface ProgressBarProps extends BasicProps, React.ComponentPropsWithoutRef<'progress'> {
62
+ /** `Attribute` Sets colored bar at the level against `max` value (`100` by default) */
37
63
  value?: number;
64
+ /** `Attribute` Sets the entire bar length comparing with current `value` */
38
65
  max?: number;
39
- style?: React.CSSProperties;
66
+ /** `Styling` Color based on bulma's color tokens */
40
67
  color?: basicColorType;
68
+ /** `Styling` Set progress bar's size */
41
69
  size?: basicSizeType;
70
+ /** `Styling` Will change `value` for a animated loading */
42
71
  isLoading?: boolean;
43
72
  }
44
73
  interface BlockProps extends BasicProps, React.ComponentPropsWithoutRef<'section'> {
45
- testId?: string;
74
+ /** `Attribute` Reffers to the component or array of components that will be shown inside the block */
75
+ children?: string | React.ReactElement | React.ReactElement[];
46
76
  }
47
77
  interface TagProps extends BasicProps, React.ComponentPropsWithoutRef<'span'> {
78
+ /** `Attribute` `Required` The text will be shown in the `Tag` */
48
79
  text: string;
80
+ /** `Attribute` Will add a delete button (for both single or addon cases) */
81
+ withDelete?: boolean;
82
+ /** `Attribute` Will add a second tag element (that could have its own text, color and delete) */
83
+ withAddon?: boolean;
84
+ /** `Attribute` The text will be shown in the tag's addon */
85
+ addonText?: string;
86
+ /** `Styling` Color based on bulma's color tokens */
49
87
  color?: basicColorType;
88
+ /** `Styling` Will adjust the selected color with a ligther style */
50
89
  isLight?: boolean;
90
+ /** `Styling` Will add round borders to tag's shape */
51
91
  isRounded?: boolean;
92
+ /** `Styling` Set tag's size */
52
93
  size?: Exclude<basicSizeType, 'is-normal'>;
53
- withDelete?: boolean;
54
- withAddon?: boolean;
55
- addonText?: string;
94
+ /** `Styling` Color on tag's addon based on bulma's color tokens */
56
95
  addonColor?: basicColorType;
96
+ /** `Function` Click function for `delete` option, alone does not nothing, but can be reused for other components */
57
97
  onDeleteClick?: () => void;
58
98
  }
59
99
  interface BoxProps extends BasicProps, React.ComponentPropsWithoutRef<'section'> {
100
+ /** `Attribute` Reffers to the component or array of components that will be shown inside the box */
101
+ children?: string | React.ReactElement | React.ReactElement[];
60
102
  }
61
103
  interface TitleSectionProps extends BasicProps, React.ComponentPropsWithoutRef<'p'> {
104
+ /** `Attribute` Sets the text you want to show */
62
105
  text: string;
106
+ /** `Styling` Set text size */
63
107
  size?: titleSizeType;
64
- prop: 'title' | 'subtitle';
108
+ /** `Styling` Set type of title (`title` at top, `subtitle` at below) */
109
+ type: 'title' | 'subtitle';
110
+ /** `Styling` Set text spacing at default or maximun length */
65
111
  isSpaced?: boolean;
66
112
  }
67
113
  interface TitleProps {
114
+ /** `Attribute` Main title configuration object */
68
115
  main?: TitleSectionProps;
116
+ /** `Attribute` Subtitle title configuration object */
69
117
  secondary?: TitleSectionProps;
70
118
  }
71
119
  interface IconProps extends BasicProps {
120
+ /** `Attribute` `Required` Sets the icon key work based on [Material Design icon list](https://pictogrammers.com/library/mdi/) */
72
121
  iconLabel: string;
122
+ /** `Attribute` Sets the text you want to show next to the icon */
73
123
  text?: string;
124
+ /** `Styling` Color based on bulma's text color tokens */
74
125
  color?: textColorType;
126
+ /** `Styling` Set icons's size */
75
127
  size?: Exclude<basicSizeType, 'is-normal'>;
128
+ /** `Styling` Special usage in case you want to set as dark or light mode */
76
129
  colorMode?: iconColorModeType;
130
+ /** `Styling` Animates the icon spinning 360° */
77
131
  isSpinning?: boolean;
78
132
  }
79
133
  interface InputProps extends BasicProps {
134
+ /** `Attribute` `Required` What type of input will be used */
80
135
  type: inputTypes;
136
+ /** `Attribute` The value that will be shown on the input */
81
137
  text?: string;
138
+ /** `Attribute` Will disable the input */
82
139
  isDisabled?: boolean;
140
+ /** `Attribute` Will show the input as a normal one, but is not editable and has no shadow */
83
141
  isReadonly?: boolean;
142
+ /** `Styling` Color based on bulma's text color tokens */
84
143
  color?: basicColorType;
144
+ /** `Styling` Set input's size */
85
145
  size?: basicSizeType;
146
+ /** `Styling` Will add round borders to input's shape */
86
147
  isRounded?: boolean;
148
+ /** `Styling` Will add a specific border when the input is hovered by the user */
87
149
  isHovered?: boolean;
150
+ /** `Styling` Will add a specific border when the input is focused by the user */
88
151
  isFocused?: boolean;
152
+ /** `Function` Click function. Alone does not nothing, but can be reused for other components */
89
153
  onClick?: () => void;
154
+ /** `Function` Reffers to each time the user press a key. Alone does not nothing, but can be reused for other components */
90
155
  onChange?: () => void;
91
156
  }
92
157
  interface TextAreaProps extends Omit<InputProps, 'isRounded' | 'type'> {
158
+ /** `Attribute` Text area's columns value that sets its width */
93
159
  cols?: number;
160
+ /** `Attribute` Text area's rows value that sets its height */
94
161
  rows?: number;
162
+ /** `Styling` Will disable characteristic sizable property by removing its control on bottom-right corner */
95
163
  isFixedSize?: boolean;
96
164
  }
97
165
  interface DeleteProps extends BasicProps {
166
+ /** `Styling` Set icons's size */
98
167
  size?: Exclude<basicSizeType, 'is-normal'>;
168
+ /** `Function` Click function. Alone does not nothing, but can be reused for other components */
99
169
  onClick?: () => void;
100
170
  }
101
171
  interface SelectOption {
@@ -104,25 +174,43 @@ interface SelectOption {
104
174
  selected?: boolean;
105
175
  }
106
176
  interface SelectProps extends BasicProps {
177
+ /** `Attribute` Indicates the options contained on the select */
107
178
  options?: SelectOption[];
179
+ /** `Attribute` Indicates how many options will be shown at first glance (before looking for the whole list */
108
180
  showOptions?: number;
181
+ /** `Attribute` Will allow multiple selection */
109
182
  isMultiple?: boolean;
183
+ /** `Styling` Color based on bulma's color tokens */
110
184
  color?: basicColorType;
185
+ /** `Styling` Set select's size */
111
186
  size?: basicSizeType;
187
+ /** `Styling`Will add round borders to input's shape */
112
188
  isRounded?: boolean;
189
+ /** `Styling`Will add a specific border when the input is hovered by the user */
113
190
  isHovered?: boolean;
191
+ /** `Styling`Will add a specific border when the input is focused by the user */
114
192
  isFocused?: boolean;
193
+ /** `Function` Click function. Alone does not nothing, but can be reused for other components */
115
194
  onClick?: () => void;
116
195
  }
117
196
  interface FileProps extends BasicProps {
197
+ /** `Attribute` The name of the file to be uploaded */
118
198
  fileName?: string;
199
+ /** `Attribute` The icon displayed in file's button" */
119
200
  uploadIcon?: IconProps;
201
+ /** `Attribute` The text displayed in file's button */
120
202
  uploadText?: string;
203
+ /** `Styling` Changes button's position to its right */
121
204
  buttonOnRight?: boolean;
205
+ /** `Styling` The whole container (button and file name) will occupy its parent container width */
122
206
  isFullWidth?: boolean;
207
+ /** `Styling` Changes styling to a box style, making the button bigger and file name's position below the button */
123
208
  isBoxed?: boolean;
209
+ /** `Styling` Color based on bulma's color tokens */
124
210
  color?: basicColorType;
211
+ /** `Styling` Set button's size */
125
212
  size?: basicSizeType;
213
+ /** `Function` Click function, alone does not nothing, but can be reused for other components */
126
214
  onClick?: () => void;
127
215
  }
128
216