reactive-bulma 2.10.0 → 2.11.0
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/cjs/index.js +83 -5
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/types/components/molecules/FormField/index.d.ts +4 -0
- package/dist/cjs/types/components/molecules/InputControl/index.d.ts +4 -0
- package/dist/cjs/types/components/molecules/index.d.ts +2 -0
- package/dist/cjs/types/functions/parsers.d.ts +1 -6
- package/dist/cjs/types/interfaces/atomProps.d.ts +20 -14
- package/dist/cjs/types/interfaces/commonProps.d.ts +1 -1
- package/dist/cjs/types/interfaces/functionProps.d.ts +5 -0
- package/dist/cjs/types/interfaces/moleculeProps.d.ts +39 -9
- package/dist/cjs/types/types/styleTypes.d.ts +5 -3
- package/dist/esm/index.js +82 -6
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/types/components/molecules/FormField/index.d.ts +4 -0
- package/dist/esm/types/components/molecules/InputControl/index.d.ts +4 -0
- package/dist/esm/types/components/molecules/index.d.ts +2 -0
- package/dist/esm/types/functions/parsers.d.ts +1 -6
- package/dist/esm/types/interfaces/atomProps.d.ts +20 -14
- package/dist/esm/types/interfaces/commonProps.d.ts +1 -1
- package/dist/esm/types/interfaces/functionProps.d.ts +5 -0
- package/dist/esm/types/interfaces/moleculeProps.d.ts +39 -9
- package/dist/esm/types/types/styleTypes.d.ts +5 -3
- package/dist/index.d.ts +66 -24
- package/package.json +1 -1
@@ -9,3 +9,5 @@ export { default as MenuList } from './MenuList';
|
|
9
9
|
export { default as Pagination } from './Pagination';
|
10
10
|
export { default as Modal } from './Modal';
|
11
11
|
export { default as Tabs } from './Tabs';
|
12
|
+
export { default as InputControl } from './InputControl';
|
13
|
+
export { default as FormField } from './FormField';
|
@@ -1,5 +1,5 @@
|
|
1
1
|
import { GenericObjectProps } from '../interfaces/commonProps';
|
2
|
-
import { ParseTestIdProps } from '../interfaces/functionProps';
|
2
|
+
import { CreateObjArrayProps, ParseTestIdProps } from '../interfaces/functionProps';
|
3
3
|
/**
|
4
4
|
* @param { Array<string | null> } _classes `Required`. Array of classNames on `string` (or `null`) values
|
5
5
|
* @returns { string } A single string product of merge all classNames, separated by spaces
|
@@ -14,9 +14,4 @@ export declare const parseClasses: (_classes: Array<string | null | undefined>)
|
|
14
14
|
*/
|
15
15
|
export declare const parseTestId: (config: ParseTestIdProps) => string;
|
16
16
|
export declare const parseKey: (max?: number, min?: number) => string;
|
17
|
-
interface CreateObjArrayProps {
|
18
|
-
numberOfItems?: number;
|
19
|
-
externalParser?: (i: number) => GenericObjectProps;
|
20
|
-
}
|
21
17
|
export declare const createObjArray: <ImportedProps>({ numberOfItems, externalParser }?: CreateObjArrayProps) => ImportedProps[] | GenericObjectProps[];
|
22
|
-
export {};
|
@@ -1,6 +1,6 @@
|
|
1
1
|
import React from 'react';
|
2
2
|
import { ElementProps, ComposedElementProps, ClickeableProps } from './commonProps';
|
3
|
-
import { basicColorType, columnOffsetType, columnSizeType, fixedImageSizeType, iconColorModeType,
|
3
|
+
import { basicColorType, columnOffsetType, columnSizeType, fixedImageSizeType, iconColorModeType, elementSizeType, sizeWithoutNormalType, textColorType, titleSizeType, rightLeftAlignType } from '../types/styleTypes';
|
4
4
|
import { DropdownItemType, inputTypes } from '../types/domTypes';
|
5
5
|
export interface ColumnProps extends ElementProps, React.ComponentPropsWithoutRef<'section'> {
|
6
6
|
/** `Attribute` Reffers to the component or array of components that will be shown inside the column */
|
@@ -27,14 +27,14 @@ export interface ButtonProps extends ElementProps, React.ComponentPropsWithoutRe
|
|
27
27
|
isOutlined?: boolean;
|
28
28
|
/** `Styling` Will add round borders to button's shape */
|
29
29
|
isRounded?: boolean;
|
30
|
-
/** `Styling` Will change `text` for
|
30
|
+
/** `Styling` Will change `text` for an animated spinner, but will remain clickeable */
|
31
31
|
isLoading?: boolean;
|
32
32
|
/** `Styling` Similar to `isDisabled`, but will remove any color style */
|
33
33
|
isStatic?: boolean;
|
34
34
|
/** `Styling` Sets the button style when a User selects it (useful for an attached `ButtonGroup`) */
|
35
35
|
isSelected?: boolean;
|
36
36
|
/** `Styling` Set button's size on bulma's size tokens */
|
37
|
-
size?:
|
37
|
+
size?: elementSizeType;
|
38
38
|
/** `Function` Click function, alone does not nothing, but can be reused for other components */
|
39
39
|
onClick?: () => void;
|
40
40
|
}
|
@@ -46,8 +46,8 @@ export interface ProgressBarProps extends ElementProps, React.ComponentPropsWith
|
|
46
46
|
/** `Styling` Color based on bulma's color tokens */
|
47
47
|
color?: basicColorType;
|
48
48
|
/** `Styling` Set progress bar's size */
|
49
|
-
size?:
|
50
|
-
/** `Styling` Will change `value` for
|
49
|
+
size?: elementSizeType;
|
50
|
+
/** `Styling` Will change `value` for an animated loading */
|
51
51
|
isLoading?: boolean;
|
52
52
|
}
|
53
53
|
export interface BlockProps extends ElementProps, React.ComponentPropsWithoutRef<'section'> {
|
@@ -70,7 +70,7 @@ export interface TagProps extends ComposedElementProps, React.ComponentPropsWith
|
|
70
70
|
/** `Styling` Will add round borders to tag's shape */
|
71
71
|
isRounded?: boolean;
|
72
72
|
/** `Styling` Set tag's size */
|
73
|
-
size?:
|
73
|
+
size?: sizeWithoutNormalType;
|
74
74
|
/** `Styling` Color on tag's addon based on bulma's color tokens */
|
75
75
|
addonColor?: basicColorType;
|
76
76
|
/** `Function` Click function for `delete` option, alone does not nothing, but can be reused for other components */
|
@@ -79,6 +79,8 @@ export interface TagProps extends ComposedElementProps, React.ComponentPropsWith
|
|
79
79
|
export interface ImageProps extends ComposedElementProps, React.ComponentPropsWithoutRef<'figure'> {
|
80
80
|
/** `Attribute` `Required` The image source that will be shown */
|
81
81
|
src: string;
|
82
|
+
/** `Attribute` A description text for the image, useful for accessibility purposes */
|
83
|
+
alt?: string;
|
82
84
|
/** `Styling` Will add round borders to image's shape */
|
83
85
|
fixedSize?: fixedImageSizeType;
|
84
86
|
/** `Styling` Sets image size based on one of fixed ratios/fixed sizes */
|
@@ -112,17 +114,21 @@ export interface IconProps extends ComposedElementProps {
|
|
112
114
|
/** `Styling` Color based on bulma's text color tokens */
|
113
115
|
color?: textColorType;
|
114
116
|
/** `Styling` Set icons's size */
|
115
|
-
size?:
|
117
|
+
size?: sizeWithoutNormalType;
|
116
118
|
/** `Styling` Special usage in case you want to set as dark or light mode */
|
117
119
|
colorMode?: iconColorModeType;
|
118
120
|
/** `Styling` Animates the icon spinning 360° */
|
119
121
|
isSpinning?: boolean;
|
122
|
+
/** `Styling` Used for `InputControl` styling purpose only. Will move the Icon itself to control's Input side */
|
123
|
+
position?: rightLeftAlignType;
|
120
124
|
}
|
121
125
|
export interface InputProps extends ElementProps, ClickeableProps {
|
122
126
|
/** `Attribute` `Required` What type of input will be used */
|
123
127
|
type: inputTypes;
|
124
128
|
/** `Attribute` The value that will be shown on the input */
|
125
129
|
text?: string;
|
130
|
+
/** `Attribute` The text that will be shown if the user does not type any value */
|
131
|
+
placeholder?: string;
|
126
132
|
/** `Attribute` Will disable the input */
|
127
133
|
isDisabled?: boolean;
|
128
134
|
/** `Attribute` Will show the input as a normal one, but is not editable and has no shadow */
|
@@ -130,7 +136,7 @@ export interface InputProps extends ElementProps, ClickeableProps {
|
|
130
136
|
/** `Styling` Color based on bulma's text color tokens */
|
131
137
|
color?: basicColorType;
|
132
138
|
/** `Styling` Set input's size */
|
133
|
-
size?:
|
139
|
+
size?: sizeWithoutNormalType;
|
134
140
|
/** `Styling` Will add round borders to input's shape */
|
135
141
|
isRounded?: boolean;
|
136
142
|
/** `Styling` Will add a specific border when the input is hovered by the user */
|
@@ -150,7 +156,7 @@ export interface TextAreaProps extends Omit<InputProps, 'isRounded' | 'type'> {
|
|
150
156
|
}
|
151
157
|
export interface DeleteProps extends ElementProps, ClickeableProps {
|
152
158
|
/** `Styling` Set icons's size */
|
153
|
-
size?:
|
159
|
+
size?: sizeWithoutNormalType;
|
154
160
|
}
|
155
161
|
export interface SelectOption {
|
156
162
|
id: string | number;
|
@@ -167,7 +173,7 @@ export interface SelectProps extends ComposedElementProps, ClickeableProps {
|
|
167
173
|
/** `Styling` Color based on bulma's color tokens */
|
168
174
|
color?: basicColorType;
|
169
175
|
/** `Styling` Set select's size */
|
170
|
-
size?:
|
176
|
+
size?: elementSizeType;
|
171
177
|
/** `Styling`Will add round borders to input's shape */
|
172
178
|
isRounded?: boolean;
|
173
179
|
/** `Styling`Will add a specific border when the input is hovered by the user */
|
@@ -191,7 +197,7 @@ export interface FileProps extends ComposedElementProps, ClickeableProps {
|
|
191
197
|
/** `Styling` Color based on bulma's color tokens */
|
192
198
|
color?: basicColorType;
|
193
199
|
/** `Styling` Set button's size */
|
194
|
-
size?:
|
200
|
+
size?: elementSizeType;
|
195
201
|
}
|
196
202
|
export interface CheckBoxProps extends ComposedElementProps {
|
197
203
|
/** `Attribute` Sets checkbox's text that will be shown next to its control */
|
@@ -250,9 +256,9 @@ export interface MenuItemProps extends ElementProps, ClickeableProps {
|
|
250
256
|
export interface PaginationItemProps extends ElementProps, ClickeableProps {
|
251
257
|
/** `Attribute` `Required` Sets the number string that will be shown in the item and in its title when user hovers it */
|
252
258
|
text: string | number;
|
253
|
-
/** `Attribute` Sets
|
259
|
+
/** `Attribute` Sets a custom text before the `text` when user hovers the item */
|
254
260
|
labelText?: string;
|
255
|
-
/** `Attribute` Sets
|
261
|
+
/** `Attribute` Sets a custom text before the `text` when user hovers the item if is the current one */
|
256
262
|
currentLabelText?: string;
|
257
263
|
/** `Styling` Makes the item the selected one, changing its background to blue */
|
258
264
|
isSelected?: boolean;
|
@@ -262,6 +268,6 @@ export interface TabItemProps extends ComposedElementProps, ClickeableProps {
|
|
262
268
|
text: string;
|
263
269
|
/** `Attribute` Adds an `Icon` component before the text */
|
264
270
|
icon?: IconProps;
|
265
|
-
/** `Styling` Used for Tabs styling purpose only. Will mark the tab as the one selected among its group */
|
271
|
+
/** `Styling` Used for `Tabs` styling purpose only. Will mark the tab as the one selected among its group */
|
266
272
|
isActive?: boolean;
|
267
273
|
}
|
@@ -1,3 +1,4 @@
|
|
1
|
+
import { GenericObjectProps } from './commonProps';
|
1
2
|
interface RegExpRule {
|
2
3
|
regExp?: RegExp;
|
3
4
|
replacer?: string;
|
@@ -8,4 +9,8 @@ export interface ParseTestIdProps {
|
|
8
9
|
rules?: RegExpRule[];
|
9
10
|
separator?: string;
|
10
11
|
}
|
12
|
+
export interface CreateObjArrayProps {
|
13
|
+
numberOfItems?: number;
|
14
|
+
externalParser?: (i: number) => GenericObjectProps;
|
15
|
+
}
|
11
16
|
export {};
|
@@ -1,7 +1,7 @@
|
|
1
1
|
/// <reference types="react" />
|
2
2
|
import { ClickeableProps, ComposedElementProps, ElementProps } from './commonProps';
|
3
|
-
import { BreadcrumbItemProps, ButtonProps, ColumnProps, DeleteProps, DropdownItemProps, MenuItemProps, PaginationItemProps, TabItemProps } from './atomProps';
|
4
|
-
import { basicColorType,
|
3
|
+
import { BreadcrumbItemProps, ButtonProps, ColumnProps, DeleteProps, DropdownItemProps, IconProps, InputProps, MenuItemProps, PaginationItemProps, TabItemProps } from './atomProps';
|
4
|
+
import { basicColorType, rightCenteredAlignType, breadcrumbSeparatorType, columnGapType, sizeWithoutNormalType, tabsFormatType } from '../types/styleTypes';
|
5
5
|
export interface ButtonGroupProps extends ElementProps {
|
6
6
|
/** `Atribute` `Required` Array of `Button` objects that will be shown */
|
7
7
|
buttonList: ButtonProps[];
|
@@ -38,11 +38,11 @@ export interface BreadcrumbsProps extends ComposedElementProps {
|
|
38
38
|
/** `Atribute` `Required` Array of `BreadcrumbItems` objects that will be shown */
|
39
39
|
items: BreadcrumbItemProps[];
|
40
40
|
/** `Styling` Will adjust element position on screen */
|
41
|
-
alignment?:
|
41
|
+
alignment?: rightCenteredAlignType | null;
|
42
42
|
/** `Styling` Will adjust element position on screen */
|
43
43
|
separator?: breadcrumbSeparatorType | null;
|
44
44
|
/** `Styling` Set button's size on bulma's size tokens */
|
45
|
-
size?:
|
45
|
+
size?: sizeWithoutNormalType;
|
46
46
|
}
|
47
47
|
export interface DropdownProps extends ElementProps {
|
48
48
|
/** `Atribute` `Required` Sets the name will be shown on the dropdown input */
|
@@ -62,7 +62,7 @@ export interface MessageProps extends ElementProps {
|
|
62
62
|
/** `Styling` Color based on bulma's color tokens */
|
63
63
|
color?: basicColorType;
|
64
64
|
/** `Styling` Set button's size on bulma's size tokens */
|
65
|
-
size?:
|
65
|
+
size?: sizeWithoutNormalType;
|
66
66
|
}
|
67
67
|
interface MenuSubListProps {
|
68
68
|
subListTitle: MenuItemProps;
|
@@ -105,9 +105,9 @@ export interface PaginationProps extends ComposedElementProps {
|
|
105
105
|
/** `Styling` Will add round borders to each page's shape */
|
106
106
|
isRounded?: boolean;
|
107
107
|
/** `Styling` Set button's size on bulma's size tokens */
|
108
|
-
size?:
|
108
|
+
size?: sizeWithoutNormalType;
|
109
109
|
/** `Styling` Will adjust the pages position on screen */
|
110
|
-
alignment?:
|
110
|
+
alignment?: rightCenteredAlignType | null;
|
111
111
|
}
|
112
112
|
export interface ModalProps extends ComposedElementProps {
|
113
113
|
/** `Attribute` Reffers to the component or array of components that will be shown inside the column */
|
@@ -119,9 +119,9 @@ export interface TabsProps extends ElementProps {
|
|
119
119
|
/** `Attribute` `Required` List of tabs that will be shown in order */
|
120
120
|
tabs: TabItemProps[];
|
121
121
|
/** `Styling` Will adjust the tabs position on screen */
|
122
|
-
alignment?:
|
122
|
+
alignment?: rightCenteredAlignType;
|
123
123
|
/** `Styling` Set tab's size on bulma's size tokens */
|
124
|
-
size?:
|
124
|
+
size?: sizeWithoutNormalType;
|
125
125
|
/** `Styling` Set tab's size on bulma's size tokens */
|
126
126
|
format?: tabsFormatType;
|
127
127
|
/** `Styling` Will add round tabs borders. Only visible if `format` is set to `is-toggle` */
|
@@ -129,4 +129,34 @@ export interface TabsProps extends ElementProps {
|
|
129
129
|
/** `Styling` The whole container will occupy its parent container width */
|
130
130
|
isFullWidth?: boolean;
|
131
131
|
}
|
132
|
+
export interface InputControlProps extends ElementProps {
|
133
|
+
/** `Attribute` `Required` control's input configuration which will be wrapped */
|
134
|
+
inputConfig: InputProps;
|
135
|
+
/** `Attribute` `Icon` configuration that will be shown in Input's left side */
|
136
|
+
leftIcon?: IconProps;
|
137
|
+
/** `Attribute` `Icon` configuration that will be shown in Input's right side */
|
138
|
+
rightIcon?: IconProps;
|
139
|
+
/** `Styling` Set control and its input size on bulma's size tokens */
|
140
|
+
size?: sizeWithoutNormalType;
|
141
|
+
/** `Styling` Will add an animated spinner on input's right side */
|
142
|
+
isLoading?: boolean;
|
143
|
+
/** `Styling` Used for `FormField` styling purpose only. Will strech the input and its container in full-width */
|
144
|
+
isExpanded?: boolean;
|
145
|
+
}
|
146
|
+
export interface FormFieldHelperProps {
|
147
|
+
text?: string;
|
148
|
+
color?: basicColorType;
|
149
|
+
}
|
150
|
+
export interface FormFieldProps extends ElementProps {
|
151
|
+
/** `Attribute` Sets a custom text before the wrapped input to indicate its usage */
|
152
|
+
labelText?: string;
|
153
|
+
/** `Attribute` `Required` Single or multiple `InputControlProps` config objects which will be wrapped around the `FormField` */
|
154
|
+
inputControlConfig: InputControlProps | InputControlProps[];
|
155
|
+
/** `Attribute` Adds a helper text below the wrapped paragraph to provide context information */
|
156
|
+
helperConfig?: FormFieldHelperProps;
|
157
|
+
/** `Styling` Will adjust field's sections (label, input/s and helper) in horizontal position */
|
158
|
+
isHorizontal?: boolean;
|
159
|
+
/** `Styling` Will group the list of inputs in a same wrapper (useful for several inputs with same usage, as a complex address) */
|
160
|
+
isGrouped?: boolean;
|
161
|
+
}
|
132
162
|
export {};
|
@@ -4,10 +4,12 @@ export type columnOffsetType = 'is-offset-1' | 'is-offset-2' | 'is-offset-3' | '
|
|
4
4
|
export type basicColorType = 'is-white' | 'is-light' | 'is-dark' | 'is-black' | 'is-text' | 'is-ghost' | 'is-primary' | 'is-link' | 'is-info' | 'is-success' | 'is-warning' | 'is-danger';
|
5
5
|
export type textColorType = 'has-text-white' | 'has-text-black' | 'has-text-light' | 'has-text-dark' | 'has-text-primary' | 'has-text-link' | 'has-text-info' | 'has-text-success' | 'has-text-warning' | 'has-text-danger';
|
6
6
|
export type fixedImageSizeType = 'is-16x16' | 'is-24x24' | 'is-32x32' | 'is-48x48' | 'is-64x64' | 'is-96x96' | 'is-128x128' | 'is-square' | 'is-1by1' | 'is-5by4' | 'is-4by3' | 'is-3by2' | 'is-5by3' | 'is-16by9' | 'is-2by1' | 'is-3by1' | 'is-4by5' | 'is-3by4' | 'is-2by3' | 'is-3by5' | 'is-9by16' | 'is-1by2' | 'is-1by3';
|
7
|
-
export type
|
8
|
-
export type
|
7
|
+
export type elementSizeType = 'is-small' | 'is-normal' | 'is-medium' | 'is-large';
|
8
|
+
export type sizeWithoutNormalType = Exclude<elementSizeType, 'is-normal'>;
|
9
9
|
export type iconColorModeType = 'light' | 'dark';
|
10
10
|
export type columnGapType = 'is-0' | 'is-1' | 'is-2' | 'is-3' | 'is-4' | 'is-5' | 'is-6' | 'is-7' | 'is-8';
|
11
|
-
export type elementAlignType = 'is-centered' | 'is-right';
|
11
|
+
export type elementAlignType = 'is-centered' | 'is-right' | 'is-left';
|
12
|
+
export type rightCenteredAlignType = Exclude<elementAlignType, 'is-left'>;
|
13
|
+
export type rightLeftAlignType = Exclude<elementAlignType, 'is-centered'>;
|
12
14
|
export type breadcrumbSeparatorType = 'has-arrow-separator' | 'has-bullet-separator' | 'has-dot-separator' | 'has-succeeds-separator';
|
13
15
|
export type tabsFormatType = 'is-boxed' | 'is-toggle';
|
package/dist/esm/index.js
CHANGED
@@ -2985,11 +2985,12 @@ const generateIconContainer = (icon, color) => {
|
|
2985
2985
|
});
|
2986
2986
|
return (React.createElement("span", { "data-testid": containerTestId, className: containerClasses }, icon));
|
2987
2987
|
};
|
2988
|
-
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 }) => {
|
2988
|
+
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, position = null }) => {
|
2989
2989
|
const iconContainerClasses = parseClasses([
|
2990
2990
|
'icon',
|
2991
2991
|
color,
|
2992
2992
|
size,
|
2993
|
+
position,
|
2993
2994
|
containerCssClasses
|
2994
2995
|
]);
|
2995
2996
|
const iconClasses = parseClasses([
|
@@ -3022,7 +3023,7 @@ const Icon = ({ testId = null, containerTestId = null, cssClasses = null, contai
|
|
3022
3023
|
return text ? generateIconContainer(iconComponent, color) : iconComponent;
|
3023
3024
|
};
|
3024
3025
|
|
3025
|
-
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 }) => {
|
3026
|
+
const Input = ({ testId = null, cssClasses = null, style = null, type, text = null, placeholder = null, isDisabled = false, isReadonly = false, color = null, size = null, isRounded = null, isHovered = null, isFocused = null, onClick = null, onChange = null }) => {
|
3026
3027
|
const inputClasses = parseClasses([
|
3027
3028
|
'input',
|
3028
3029
|
color,
|
@@ -3036,7 +3037,7 @@ const Input = ({ testId = null, cssClasses = null, style = null, type, text = nu
|
|
3036
3037
|
tag: 'input',
|
3037
3038
|
parsedClasses: inputClasses
|
3038
3039
|
});
|
3039
|
-
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 }));
|
3040
|
+
return (React.createElement("input", { "data-testid": inputTestId, type: type, placeholder: placeholder !== null && placeholder !== void 0 ? placeholder : undefined, 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 }));
|
3040
3041
|
};
|
3041
3042
|
|
3042
3043
|
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 }) => {
|
@@ -3249,7 +3250,7 @@ const MenuItem = ({ testId = null, cssClasses = null, style = null, text, isActi
|
|
3249
3250
|
return (React.createElement("a", { "data-testid": menuItemTestId, className: menuItemClasses, style: style !== null && style !== void 0 ? style : undefined, "aria-hidden": 'true', onClick: onClick !== null && onClick !== void 0 ? onClick : undefined }, text));
|
3250
3251
|
};
|
3251
3252
|
|
3252
|
-
const Image = ({ testId = null, containerTestId = null, cssClasses = null, containerCssClasses = null, style = null, containerStyle = null, src, fixedSize = 'is-1by1', isRounded = false }) => {
|
3253
|
+
const Image = ({ testId = null, containerTestId = null, cssClasses = null, containerCssClasses = null, style = null, containerStyle = null, src, alt = null, fixedSize = 'is-1by1', isRounded = false }) => {
|
3253
3254
|
const imageContainerClasses = parseClasses([
|
3254
3255
|
'image',
|
3255
3256
|
fixedSize,
|
@@ -3262,7 +3263,7 @@ const Image = ({ testId = null, containerTestId = null, cssClasses = null, conta
|
|
3262
3263
|
const imageContainerTestId = containerTestId !== null && containerTestId !== void 0 ? containerTestId : parseTestId({ tag: 'image', parsedClasses: imageContainerClasses });
|
3263
3264
|
const imageTestId = testId !== null && testId !== void 0 ? testId : `${imageContainerTestId}-img`;
|
3264
3265
|
return (React.createElement("figure", { "data-testid": imageContainerTestId, className: imageContainerClasses, style: containerStyle !== null && containerStyle !== void 0 ? containerStyle : undefined },
|
3265
|
-
React.createElement("img", { "data-testid": imageTestId, className: imageClasses, style: style !== null && style !== void 0 ? style : undefined, src: src })));
|
3266
|
+
React.createElement("img", { "data-testid": imageTestId, className: imageClasses, style: style !== null && style !== void 0 ? style : undefined, src: src, alt: alt !== null && alt !== void 0 ? alt : undefined })));
|
3266
3267
|
};
|
3267
3268
|
|
3268
3269
|
const PaginationItem = ({ testId = null, cssClasses = null, style = null, text, labelText = 'Page', currentLabelText = 'Go to page', isSelected = null, onClick = null }) => {
|
@@ -3546,5 +3547,80 @@ const Tabs = ({ testId = null, cssClasses = null, style = null, tabs, alignment
|
|
3546
3547
|
React.createElement("ul", null, tabs.map(tabConfig => (React.createElement("li", { key: `tab-item-${parseKey()}`, className: tabConfig.isActive ? 'is-active' : undefined }, React.createElement(TabItem, Object.assign({}, tabConfig))))))));
|
3547
3548
|
};
|
3548
3549
|
|
3549
|
-
|
3550
|
+
const renderIcon = (iconConfig) => iconConfig ? React.createElement(Icon, Object.assign({}, iconConfig)) : null;
|
3551
|
+
const InputControl = ({ testId = null, cssClasses = null, style = null, inputConfig, leftIcon = null, rightIcon = null, size = null, isLoading = null, isExpanded = null }) => {
|
3552
|
+
const inputControlClasses = parseClasses([
|
3553
|
+
'control',
|
3554
|
+
size,
|
3555
|
+
leftIcon ? 'has-icons-left' : null,
|
3556
|
+
rightIcon ? 'has-icons-right' : null,
|
3557
|
+
isLoading ? 'is-loading' : null,
|
3558
|
+
isExpanded ? 'is-expanded' : null,
|
3559
|
+
cssClasses
|
3560
|
+
]);
|
3561
|
+
const inputControlTestId = testId !== null && testId !== void 0 ? testId : parseTestId({
|
3562
|
+
tag: 'control',
|
3563
|
+
parsedClasses: inputControlClasses,
|
3564
|
+
rules: [
|
3565
|
+
{
|
3566
|
+
regExp: /has-|is-/gm,
|
3567
|
+
replacer: '-'
|
3568
|
+
},
|
3569
|
+
{
|
3570
|
+
regExp: /control/gm,
|
3571
|
+
replacer: ''
|
3572
|
+
}
|
3573
|
+
]
|
3574
|
+
});
|
3575
|
+
const reflectedInputConfig = Object.assign(Object.assign({}, inputConfig), { size: size !== null && size !== void 0 ? size : inputConfig === null || inputConfig === void 0 ? void 0 : inputConfig.size });
|
3576
|
+
return (React.createElement("section", { "data-testid": inputControlTestId, className: inputControlClasses, style: style !== null && style !== void 0 ? style : undefined },
|
3577
|
+
React.createElement(Input, Object.assign({}, reflectedInputConfig)),
|
3578
|
+
renderIcon(leftIcon ? Object.assign(Object.assign({}, leftIcon), { position: 'is-left' }) : undefined),
|
3579
|
+
renderIcon(rightIcon ? Object.assign(Object.assign({}, rightIcon), { position: 'is-right' }) : undefined)));
|
3580
|
+
};
|
3581
|
+
|
3582
|
+
const renderFieldLabel = (labelText) => labelText ? (React.createElement("label", { "data-testid": 'test-form-field-label', className: 'label' }, labelText)) : null;
|
3583
|
+
const renderFieldBody = (inputControlConfig, isGrouped) => {
|
3584
|
+
if (isGrouped) {
|
3585
|
+
return Array.isArray(inputControlConfig) ? (inputControlConfig.map((_singleConfig, i) => (React.createElement(InputControl, Object.assign({ key: `grouped-input-control-${parseKey()}`, testId: `test-grouped-input-control-${i}` }, _singleConfig))))) : (React.createElement(InputControl, Object.assign({}, inputControlConfig)));
|
3586
|
+
}
|
3587
|
+
else {
|
3588
|
+
return Array.isArray(inputControlConfig) ? (React.createElement(InputControl, Object.assign({}, inputControlConfig[0]))) : (React.createElement(InputControl, Object.assign({}, inputControlConfig)));
|
3589
|
+
}
|
3590
|
+
};
|
3591
|
+
const renderFieldHelper = (helperConfig) => {
|
3592
|
+
if (!helperConfig)
|
3593
|
+
return null;
|
3594
|
+
const fieldHelperClasses = parseClasses(['help', helperConfig.color]);
|
3595
|
+
const fieldHelperTestId = parseTestId({
|
3596
|
+
tag: 'form-field-help',
|
3597
|
+
parsedClasses: fieldHelperClasses,
|
3598
|
+
rules: [{ regExp: /help|is/gm, replacer: '' }]
|
3599
|
+
});
|
3600
|
+
return (React.createElement("p", { "data-testid": fieldHelperTestId, className: fieldHelperClasses }, helperConfig.text));
|
3601
|
+
};
|
3602
|
+
const FormField = ({ testId = null, cssClasses = null, style = null, labelText = null, inputControlConfig, helperConfig = null, isHorizontal = false, isGrouped = false }) => {
|
3603
|
+
var _a;
|
3604
|
+
const formFieldClasses = parseClasses([
|
3605
|
+
'field',
|
3606
|
+
isHorizontal ? 'is-horizontal' : null,
|
3607
|
+
isGrouped ? 'is-grouped' : null,
|
3608
|
+
cssClasses
|
3609
|
+
]);
|
3610
|
+
const formFieldTestId = testId !== null && testId !== void 0 ? testId : parseTestId({ tag: 'field', parsedClasses: formFieldClasses });
|
3611
|
+
if (!isGrouped &&
|
3612
|
+
((_a = inputControlConfig === null || inputControlConfig === void 0 ? void 0 : inputControlConfig.inputConfig) === null || _a === void 0 ? void 0 : _a.color) &&
|
3613
|
+
helperConfig) {
|
3614
|
+
helperConfig = Object.assign(Object.assign({}, helperConfig), { color: inputControlConfig.inputConfig.color });
|
3615
|
+
}
|
3616
|
+
return (React.createElement("section", { "data-testid": formFieldTestId, className: formFieldClasses, style: style !== null && style !== void 0 ? style : undefined },
|
3617
|
+
isHorizontal ? (React.createElement("section", { className: 'field-label' }, renderFieldLabel(labelText))) : (renderFieldLabel(labelText)),
|
3618
|
+
isHorizontal ? (React.createElement("section", { className: 'field-body' },
|
3619
|
+
renderFieldBody(inputControlConfig, isGrouped),
|
3620
|
+
renderFieldHelper(helperConfig))) : (React.createElement(React.Fragment, null,
|
3621
|
+
renderFieldBody(inputControlConfig, isGrouped),
|
3622
|
+
renderFieldHelper(helperConfig)))));
|
3623
|
+
};
|
3624
|
+
|
3625
|
+
export { Block, Box, BreadcrumbItem, Breadcrumbs, Button, ButtonGroup, CheckBox as Checkbox, Column, ColumnGroup, Delete, Dropdown, DropdownItem, DropdownTrigger, File, FormField, Icon, Image, Input, InputControl, Menu, MenuItem, MenuList, Message, Modal, Notification, Pagination, PaginationItem, ProgressBar, RadioButton, Select, TabItem, Tabs, Tag, TextArea, Title };
|
3550
3626
|
//# sourceMappingURL=index.js.map
|