reactive-bulma 2.11.0 → 2.13.0
Sign up to get free protection for your applications and to get access to all the features.
- package/LICENSE +1 -1
- package/README.md +2 -2
- package/dist/cjs/index.js +124 -34
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/types/components/atoms/LevelHeader/index.d.ts +4 -0
- package/dist/cjs/types/components/atoms/index.d.ts +1 -0
- package/dist/cjs/types/components/molecules/LevelItem/index.d.ts +4 -0
- package/dist/cjs/types/components/molecules/PanelBlock/index.d.ts +4 -0
- package/dist/cjs/types/components/molecules/PanelTabs/index.d.ts +4 -0
- package/dist/cjs/types/components/molecules/index.d.ts +3 -1
- package/dist/cjs/types/components/{molecules → organisms}/FormField/index.d.ts +1 -1
- package/dist/cjs/types/components/organisms/Level/index.d.ts +4 -0
- package/dist/cjs/types/components/organisms/Panel/index.d.ts +4 -0
- package/dist/cjs/types/components/organisms/index.d.ts +3 -0
- package/dist/cjs/types/functions/generators.d.ts +4 -0
- package/dist/cjs/types/functions/parsers.d.ts +1 -4
- package/dist/cjs/types/functions/tests/generators.test.d.ts +1 -0
- package/dist/cjs/types/index.d.ts +1 -0
- package/dist/cjs/types/interfaces/atomProps.d.ts +8 -2
- package/dist/cjs/types/interfaces/moleculeProps.d.ts +30 -15
- package/dist/cjs/types/interfaces/organismProps.d.ts +39 -0
- package/dist/cjs/types/types/domTypes.d.ts +3 -2
- package/dist/esm/index.js +119 -35
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/types/components/atoms/LevelHeader/index.d.ts +4 -0
- package/dist/esm/types/components/atoms/index.d.ts +1 -0
- package/dist/esm/types/components/molecules/LevelItem/index.d.ts +4 -0
- package/dist/esm/types/components/molecules/PanelBlock/index.d.ts +4 -0
- package/dist/esm/types/components/molecules/PanelTabs/index.d.ts +4 -0
- package/dist/esm/types/components/molecules/index.d.ts +3 -1
- package/dist/esm/types/components/{molecules → organisms}/FormField/index.d.ts +1 -1
- package/dist/esm/types/components/organisms/Level/index.d.ts +4 -0
- package/dist/esm/types/components/organisms/Panel/index.d.ts +4 -0
- package/dist/esm/types/components/organisms/index.d.ts +3 -0
- package/dist/esm/types/functions/generators.d.ts +4 -0
- package/dist/esm/types/functions/parsers.d.ts +1 -4
- package/dist/esm/types/functions/tests/generators.test.d.ts +1 -0
- package/dist/esm/types/index.d.ts +1 -0
- package/dist/esm/types/interfaces/atomProps.d.ts +8 -2
- package/dist/esm/types/interfaces/moleculeProps.d.ts +30 -15
- package/dist/esm/types/interfaces/organismProps.d.ts +39 -0
- package/dist/esm/types/types/domTypes.d.ts +3 -2
- package/dist/index.d.ts +87 -17
- package/package.json +11 -11
@@ -20,3 +20,4 @@ export { default as MenuItem } from './MenuItem';
|
|
20
20
|
export { default as Image } from './Image';
|
21
21
|
export { default as PaginationItem } from './PaginationItem';
|
22
22
|
export { default as TabItem } from './TabItem';
|
23
|
+
export { default as LevelHeader } from './LevelHeader';
|
@@ -10,4 +10,6 @@ export { default as Pagination } from './Pagination';
|
|
10
10
|
export { default as Modal } from './Modal';
|
11
11
|
export { default as Tabs } from './Tabs';
|
12
12
|
export { default as InputControl } from './InputControl';
|
13
|
-
export { default as
|
13
|
+
export { default as PanelBlock } from './PanelBlock';
|
14
|
+
export { default as PanelTabs } from './PanelTabs';
|
15
|
+
export { default as LevelItem } from '../molecules/LevelItem';
|
@@ -0,0 +1,4 @@
|
|
1
|
+
import { GenericObjectProps } from '../interfaces/commonProps';
|
2
|
+
import { CreateObjArrayProps } from '../interfaces/functionProps';
|
3
|
+
export declare const generateKey: (max?: number, min?: number) => string;
|
4
|
+
export declare const createObjArray: <ImportedProps>({ numberOfItems, externalParser }?: CreateObjArrayProps) => ImportedProps[] | GenericObjectProps[];
|
@@ -1,5 +1,4 @@
|
|
1
|
-
import {
|
2
|
-
import { CreateObjArrayProps, ParseTestIdProps } from '../interfaces/functionProps';
|
1
|
+
import { ParseTestIdProps } from '../interfaces/functionProps';
|
3
2
|
/**
|
4
3
|
* @param { Array<string | null> } _classes `Required`. Array of classNames on `string` (or `null`) values
|
5
4
|
* @returns { string } A single string product of merge all classNames, separated by spaces
|
@@ -13,5 +12,3 @@ export declare const parseClasses: (_classes: Array<string | null | undefined>)
|
|
13
12
|
* @returns A single string product of merge all classNames, separated by `separator` value
|
14
13
|
*/
|
15
14
|
export declare const parseTestId: (config: ParseTestIdProps) => string;
|
16
|
-
export declare const parseKey: (max?: number, min?: number) => string;
|
17
|
-
export declare const createObjArray: <ImportedProps>({ numberOfItems, externalParser }?: CreateObjArrayProps) => ImportedProps[] | GenericObjectProps[];
|
@@ -0,0 +1 @@
|
|
1
|
+
export {};
|
@@ -1,7 +1,7 @@
|
|
1
1
|
import React from 'react';
|
2
2
|
import { ElementProps, ComposedElementProps, ClickeableProps } from './commonProps';
|
3
3
|
import { basicColorType, columnOffsetType, columnSizeType, fixedImageSizeType, iconColorModeType, elementSizeType, sizeWithoutNormalType, textColorType, titleSizeType, rightLeftAlignType } from '../types/styleTypes';
|
4
|
-
import { DropdownItemType,
|
4
|
+
import { DropdownItemType, InputType } 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 */
|
7
7
|
children?: string | React.ReactElement | React.ReactElement[];
|
@@ -124,7 +124,7 @@ export interface IconProps extends ComposedElementProps {
|
|
124
124
|
}
|
125
125
|
export interface InputProps extends ElementProps, ClickeableProps {
|
126
126
|
/** `Attribute` `Required` What type of input will be used */
|
127
|
-
type:
|
127
|
+
type: InputType;
|
128
128
|
/** `Attribute` The value that will be shown on the input */
|
129
129
|
text?: string;
|
130
130
|
/** `Attribute` The text that will be shown if the user does not type any value */
|
@@ -271,3 +271,9 @@ export interface TabItemProps extends ComposedElementProps, ClickeableProps {
|
|
271
271
|
/** `Styling` Used for `Tabs` styling purpose only. Will mark the tab as the one selected among its group */
|
272
272
|
isActive?: boolean;
|
273
273
|
}
|
274
|
+
export interface LevelHeaderProps extends ElementProps {
|
275
|
+
/** `Attribute` `Required` A title in smaller size */
|
276
|
+
header: string;
|
277
|
+
/** `Attribute` `Required` Main value (numeric or text) to be shown in a bigger scale below `header` */
|
278
|
+
value: string | number;
|
279
|
+
}
|
@@ -2,6 +2,7 @@
|
|
2
2
|
import { ClickeableProps, ComposedElementProps, ElementProps } from './commonProps';
|
3
3
|
import { BreadcrumbItemProps, ButtonProps, ColumnProps, DeleteProps, DropdownItemProps, IconProps, InputProps, MenuItemProps, PaginationItemProps, TabItemProps } from './atomProps';
|
4
4
|
import { basicColorType, rightCenteredAlignType, breadcrumbSeparatorType, columnGapType, sizeWithoutNormalType, tabsFormatType } from '../types/styleTypes';
|
5
|
+
import { PanelBlockItemType } from '../types/domTypes';
|
5
6
|
export interface ButtonGroupProps extends ElementProps {
|
6
7
|
/** `Atribute` `Required` Array of `Button` objects that will be shown */
|
7
8
|
buttonList: ButtonProps[];
|
@@ -143,20 +144,34 @@ export interface InputControlProps extends ElementProps {
|
|
143
144
|
/** `Styling` Used for `FormField` styling purpose only. Will strech the input and its container in full-width */
|
144
145
|
isExpanded?: boolean;
|
145
146
|
}
|
146
|
-
export interface
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
/** `Attribute` `Required`
|
154
|
-
|
155
|
-
/** `Attribute`
|
156
|
-
|
157
|
-
/** `Styling` Will
|
158
|
-
|
159
|
-
|
160
|
-
|
147
|
+
export interface PanelBlockItemProps {
|
148
|
+
/** `Attribute` `Required` Indicates to component's parser which type of component will be rendered based on its option */
|
149
|
+
type: PanelBlockItemType;
|
150
|
+
/** `Attribute` `Required` The component properties that will configure that specific instance */
|
151
|
+
props: InputControlProps | IconProps | ButtonProps;
|
152
|
+
}
|
153
|
+
export interface PanelBlockProps extends ComposedElementProps, ClickeableProps {
|
154
|
+
/** `Attribute` `Required` Configuration object with a type and a set of props based on the available components that could be rendered in each `PanelBlock` */
|
155
|
+
config: PanelBlockItemProps;
|
156
|
+
/** `Attribute` Usable when config's U is `icon` only. It will display a text next to mentioned icon (for user purposes) */
|
157
|
+
blockText?: string;
|
158
|
+
/** `Styling` Used for `PanelBlock` styling purpose only. Will mark its rendered component as the one selected among its group */
|
159
|
+
isActive?: boolean;
|
160
|
+
}
|
161
|
+
export interface PanelTabItem extends ClickeableProps {
|
162
|
+
/** `Attribute` `Required` Will show the text to the user in shape of tab */
|
163
|
+
text: string;
|
164
|
+
/** `Styling` Used for `PanelTab` styling purpose only. Will mark its rendered component as the one selected among its group */
|
165
|
+
isActive?: boolean;
|
166
|
+
}
|
167
|
+
export interface PanelTabsProps extends ElementProps {
|
168
|
+
/** `Attribute` `Required` A list of configuration objects that will render a set of tabs */
|
169
|
+
tabList: PanelTabItem[];
|
170
|
+
}
|
171
|
+
export interface LevelItemProps extends ElementProps {
|
172
|
+
/** `Attribute` `Required` Reffers to the component or string content that will be shown inside the level */
|
173
|
+
content: string | React.ReactElement;
|
174
|
+
/** `Styling` Centers item's content horizontally */
|
175
|
+
isCentered?: boolean;
|
161
176
|
}
|
162
177
|
export {};
|
@@ -0,0 +1,39 @@
|
|
1
|
+
import { ElementProps } from './commonProps';
|
2
|
+
import { InputControlProps, LevelItemProps, PanelBlockProps, PanelTabsProps } from './moleculeProps';
|
3
|
+
import { basicColorType } from '../types/styleTypes';
|
4
|
+
export interface FormFieldHelperProps {
|
5
|
+
text?: string;
|
6
|
+
color?: basicColorType;
|
7
|
+
}
|
8
|
+
export interface FormFieldProps extends ElementProps {
|
9
|
+
/** `Attribute` `Required` Single or multiple `InputControlProps` config objects which will be wrapped around the `FormField` */
|
10
|
+
inputControlConfig: InputControlProps | InputControlProps[];
|
11
|
+
/** `Attribute` Sets a custom text before the wrapped input to indicate its usage */
|
12
|
+
labelText?: string;
|
13
|
+
/** `Attribute` Adds a helper text below the wrapped paragraph to provide context information */
|
14
|
+
helperConfig?: FormFieldHelperProps;
|
15
|
+
/** `Styling` Will adjust field's sections (label, input/s and helper) in horizontal position */
|
16
|
+
isHorizontal?: boolean;
|
17
|
+
/** `Styling` Will group the list of inputs in a same wrapper (useful for several inputs with same usage, as a complex address) */
|
18
|
+
isGrouped?: boolean;
|
19
|
+
}
|
20
|
+
export interface PanelProps extends ElementProps {
|
21
|
+
/** `Attribute` `Required` Will display Panel's header text */
|
22
|
+
headerText: string;
|
23
|
+
/** `Attribute` A configuration object that will render a set of tabs based on `PanelTab` component */
|
24
|
+
panelTabs?: PanelTabsProps;
|
25
|
+
/** `Attribute` `Required` A list of configuration objects that will render a list of block with different components, based on `PanelBlockList` component */
|
26
|
+
blockList: PanelBlockProps[];
|
27
|
+
/** `Styling` Color based on bulma's text color tokens */
|
28
|
+
color?: basicColorType;
|
29
|
+
}
|
30
|
+
export interface LevelProps extends ElementProps {
|
31
|
+
/** `Attribute` A list of `LevelItem` configurations that will displayed in Level's left side */
|
32
|
+
leftSide?: LevelItemProps[];
|
33
|
+
/** `Attribute` A list of `LevelItem` configurations that will displayed in Level's center */
|
34
|
+
centerSide?: LevelItemProps[];
|
35
|
+
/** `Attribute` A list of `LevelItem` configurations that will displayed in Level's right side */
|
36
|
+
rightSide?: LevelItemProps[];
|
37
|
+
/** `Styling` Will adjust the navigator on horizontal on mobile as well */
|
38
|
+
isMobile?: boolean;
|
39
|
+
}
|
@@ -1,3 +1,4 @@
|
|
1
|
-
export type
|
2
|
-
export type
|
1
|
+
export type ButtonType = 'submit' | 'reset' | 'button';
|
2
|
+
export type InputType = 'text' | 'password' | 'email' | 'tel';
|
3
3
|
export type DropdownItemType = 'item' | 'link' | 'divider';
|
4
|
+
export type PanelBlockItemType = 'icon' | 'control' | 'button';
|
package/dist/esm/index.js
CHANGED
@@ -2859,13 +2859,6 @@ const parseTestId = (config) => {
|
|
2859
2859
|
}
|
2860
2860
|
return `test-${config.tag}${fixedClassString.replace(/ /gm, (_a = config.separator) !== null && _a !== void 0 ? _a : '')}`;
|
2861
2861
|
};
|
2862
|
-
const parseKey = (max = 5000, min = 1) => {
|
2863
|
-
max = Math.floor(max);
|
2864
|
-
min = Math.ceil(min);
|
2865
|
-
const secureRandomNumbers = new Uint32Array(1);
|
2866
|
-
window.crypto.getRandomValues(secureRandomNumbers);
|
2867
|
-
return Math.floor(secureRandomNumbers[0] * (max - min) + min).toString();
|
2868
|
-
};
|
2869
2862
|
|
2870
2863
|
const Button = ({ testId = null, cssClasses = null, style = null, type = 'button', text = null, isDisabled = false, color = null, isLightColor = false, isInvertedColor = false, isOutlined = false, isRounded = false, isLoading = false, isStatic = false, isSelected = false, size = null, onClick = null }) => {
|
2871
2864
|
const buttonClasses = parseClasses([
|
@@ -3157,7 +3150,7 @@ const CheckBox = ({ testId = null, containerTestId = null, cssClasses = null, co
|
|
3157
3150
|
content));
|
3158
3151
|
};
|
3159
3152
|
|
3160
|
-
//
|
3153
|
+
// FUNCTIONS
|
3161
3154
|
const renderRadioButton = (config, index) => {
|
3162
3155
|
const { testId = null, label, name, isChecked = false, isDisabled = false, style = null, onChange } = config;
|
3163
3156
|
const radioButtonTestId = testId !== null && testId !== void 0 ? testId : `test-radio-button-item-${index}`;
|
@@ -3281,20 +3274,29 @@ const PaginationItem = ({ testId = null, cssClasses = null, style = null, text,
|
|
3281
3274
|
};
|
3282
3275
|
|
3283
3276
|
const TabItem = ({ testId = null, containerTestId = null, cssClasses = null, containerCssClasses = null, style = null, containerStyle = null, icon = null, text, onClick = null }) => {
|
3284
|
-
const tabItemContainerClasses = parseClasses([
|
3285
|
-
'tabItem-container',
|
3286
|
-
null,
|
3287
|
-
containerCssClasses
|
3288
|
-
]);
|
3289
|
-
const tabItemClasses = parseClasses(['tabItem', cssClasses]);
|
3290
3277
|
const tabItemContainerTestId = containerTestId !== null && containerTestId !== void 0 ? containerTestId : parseTestId({
|
3291
|
-
tag: '
|
3292
|
-
parsedClasses:
|
3278
|
+
tag: 'tab-item-container',
|
3279
|
+
parsedClasses: containerCssClasses !== null && containerCssClasses !== void 0 ? containerCssClasses : ''
|
3293
3280
|
});
|
3294
|
-
const tabItemTestId = testId !== null && testId !== void 0 ? testId : parseTestId({ tag: '
|
3295
|
-
return (React.createElement("a", { "data-testid": tabItemContainerTestId, className:
|
3281
|
+
const tabItemTestId = testId !== null && testId !== void 0 ? testId : parseTestId({ tag: 'tab-item', parsedClasses: cssClasses !== null && cssClasses !== void 0 ? cssClasses : '' });
|
3282
|
+
return (React.createElement("a", { "data-testid": tabItemContainerTestId, className: containerCssClasses !== null && containerCssClasses !== void 0 ? containerCssClasses : undefined, style: containerStyle !== null && containerStyle !== void 0 ? containerStyle : undefined, "aria-hidden": 'true', onClick: onClick !== null && onClick !== void 0 ? onClick : undefined },
|
3296
3283
|
icon ? React.createElement(Icon, Object.assign({}, icon)) : null,
|
3297
|
-
React.createElement("span", { "data-testid": tabItemTestId, className:
|
3284
|
+
React.createElement("span", { "data-testid": tabItemTestId, className: cssClasses !== null && cssClasses !== void 0 ? cssClasses : undefined, style: style !== null && style !== void 0 ? style : undefined }, text)));
|
3285
|
+
};
|
3286
|
+
|
3287
|
+
const LevelHeader = ({ testId = null, cssClasses = null, style = null, header, value }) => {
|
3288
|
+
const levelHeaderTestId = testId !== null && testId !== void 0 ? testId : parseTestId({ tag: 'level-header', parsedClasses: cssClasses !== null && cssClasses !== void 0 ? cssClasses : '' });
|
3289
|
+
return (React.createElement("section", { "data-testid": levelHeaderTestId, className: cssClasses !== null && cssClasses !== void 0 ? cssClasses : undefined, style: style !== null && style !== void 0 ? style : undefined },
|
3290
|
+
React.createElement("p", { className: 'heading' }, header),
|
3291
|
+
React.createElement("p", { className: 'title' }, value)));
|
3292
|
+
};
|
3293
|
+
|
3294
|
+
const generateKey = (max = 5000, min = 1) => {
|
3295
|
+
max = Math.floor(max);
|
3296
|
+
min = Math.ceil(min);
|
3297
|
+
const secureRandomNumbers = new Uint32Array(1);
|
3298
|
+
window.crypto.getRandomValues(secureRandomNumbers);
|
3299
|
+
return Math.floor(secureRandomNumbers[0] * (max - min) + min).toString();
|
3298
3300
|
};
|
3299
3301
|
|
3300
3302
|
const ButtonGroup = ({ testId = null, cssClasses = null, style = null, buttonList, isAttached = false, position = 'left' }) => {
|
@@ -3323,7 +3325,7 @@ const ButtonGroup = ({ testId = null, cssClasses = null, style = null, buttonLis
|
|
3323
3325
|
const shouldApplyColor = (hasSelectedButton && currentButtonItem.isSelected) ||
|
3324
3326
|
!hasSelectedButton;
|
3325
3327
|
const buttonConfig = Object.assign(Object.assign({}, currentButtonItem), { color: shouldApplyColor ? currentButtonItem.color : undefined });
|
3326
|
-
return (React.createElement(Button, Object.assign({ key: `button-group-item-${
|
3328
|
+
return (React.createElement(Button, Object.assign({ key: `button-group-item-${generateKey()}` }, buttonConfig)));
|
3327
3329
|
})));
|
3328
3330
|
};
|
3329
3331
|
|
@@ -3351,7 +3353,7 @@ const ColumnGroup = ({ testId = null, cssClasses = null, style = null, listOfCol
|
|
3351
3353
|
tag: 'columns',
|
3352
3354
|
parsedClasses: columnGroupClasses
|
3353
3355
|
});
|
3354
|
-
return (React.createElement("section", { "data-testid": columnGroupTestId, className: columnGroupClasses, style: style !== null && style !== void 0 ? style : undefined }, listOfColumns.map(columnItemConfig => (React.createElement(Column, Object.assign({ key: `column-group-item-${
|
3356
|
+
return (React.createElement("section", { "data-testid": columnGroupTestId, className: columnGroupClasses, style: style !== null && style !== void 0 ? style : undefined }, listOfColumns.map(columnItemConfig => (React.createElement(Column, Object.assign({ key: `column-group-item-${generateKey()}` }, columnItemConfig))))));
|
3355
3357
|
};
|
3356
3358
|
|
3357
3359
|
const Notification = ({ testId = null, cssClasses = null, style = null, children = null, deleteButton = null, color = null, isLightColor = null }) => {
|
@@ -3393,14 +3395,14 @@ const Breadcrumbs = ({ testId = 'breadcrumbs', containerTestId = null, cssClasse
|
|
3393
3395
|
]
|
3394
3396
|
});
|
3395
3397
|
return (React.createElement("nav", { "data-testid": breadcrumbsContainerTestId, className: breadcrumbsContainerClasses, style: containerStyle !== null && containerStyle !== void 0 ? containerStyle : undefined },
|
3396
|
-
React.createElement("ul", { "data-testid": testId, className: cssClasses !== null && cssClasses !== void 0 ? cssClasses : undefined, style: style !== null && style !== void 0 ? style : undefined }, items.map(itemConfig => (React.createElement(BreadcrumbItem, Object.assign({ key: `breadcrumb-item-${
|
3398
|
+
React.createElement("ul", { "data-testid": testId, className: cssClasses !== null && cssClasses !== void 0 ? cssClasses : undefined, style: style !== null && style !== void 0 ? style : undefined }, items.map(itemConfig => (React.createElement(BreadcrumbItem, Object.assign({ key: `breadcrumb-item-${generateKey()}` }, itemConfig)))))));
|
3397
3399
|
};
|
3398
3400
|
|
3399
3401
|
const renderDropdownMenu = (items) => (React.createElement("section", { className: 'dropdown-content' }, items.map((dropdownItemConfig, i) => {
|
3400
3402
|
const isFirstItemInMenu = items.length > 1 && i === 0;
|
3401
|
-
return isFirstItemInMenu ? (React.createElement(DropdownItem, Object.assign({ key: `dropdown-item-${
|
3402
|
-
React.createElement(DropdownItem, { key: `dropdown-item-${
|
3403
|
-
React.createElement(DropdownItem, Object.assign({ key: `dropdown-item-${
|
3403
|
+
return isFirstItemInMenu ? (React.createElement(DropdownItem, Object.assign({ key: `dropdown-item-${generateKey()}` }, dropdownItemConfig))) : (React.createElement("section", { key: `dropdown-item-${generateKey()}-section` },
|
3404
|
+
React.createElement(DropdownItem, { key: `dropdown-item-${generateKey()}-divider`, type: 'divider', itemText: 'divider' }),
|
3405
|
+
React.createElement(DropdownItem, Object.assign({ key: `dropdown-item-${generateKey()}` }, dropdownItemConfig))));
|
3404
3406
|
})));
|
3405
3407
|
const Dropdown = ({ testId = null, cssClasses = null, style = null, inputText, dropdownPointer = 'dropdown-menu', listOfItems }) => {
|
3406
3408
|
const [isMenuActive, setIsMenuActive] = reactExports.useState(false);
|
@@ -3432,12 +3434,12 @@ const MenuList = ({ testId = null, cssClasses = null, style = null, itemList })
|
|
3432
3434
|
const menuListTestId = testId !== null && testId !== void 0 ? testId : parseTestId({ tag: 'menu-list', parsedClasses: menuListClasses });
|
3433
3435
|
return (React.createElement("ul", { "data-testid": menuListTestId, className: menuListClasses, style: style !== null && style !== void 0 ? style : undefined }, itemList.map(item => {
|
3434
3436
|
if ('subListTitle' in item) {
|
3435
|
-
return (React.createElement("li", { key: `sub-list-menu-item-${
|
3437
|
+
return (React.createElement("li", { key: `sub-list-menu-item-${generateKey()}` },
|
3436
3438
|
React.createElement(MenuItem, Object.assign({}, item.subListTitle)),
|
3437
|
-
React.createElement("ul", null, item.subItems.map(subItem => (React.createElement(MenuItem, Object.assign({ key: `sub-list-menu-sub-item-${
|
3439
|
+
React.createElement("ul", null, item.subItems.map(subItem => (React.createElement(MenuItem, Object.assign({ key: `sub-list-menu-sub-item-${generateKey()}` }, subItem)))))));
|
3438
3440
|
}
|
3439
3441
|
else {
|
3440
|
-
return (React.createElement(MenuItem, Object.assign({ key: `sub-list-item-${
|
3442
|
+
return (React.createElement(MenuItem, Object.assign({ key: `sub-list-item-${generateKey()}` }, item)));
|
3441
3443
|
}
|
3442
3444
|
})));
|
3443
3445
|
};
|
@@ -3445,9 +3447,9 @@ const MenuList = ({ testId = null, cssClasses = null, style = null, itemList })
|
|
3445
3447
|
const Menu = ({ testId = null, cssClasses = null, style = null, menuSections }) => {
|
3446
3448
|
const menuClasses = parseClasses(['menu', cssClasses]);
|
3447
3449
|
const menuTestId = testId !== null && testId !== void 0 ? testId : parseTestId({ tag: 'menu', parsedClasses: menuClasses });
|
3448
|
-
return (React.createElement("aside", { "data-testid": menuTestId, className: menuClasses, style: style !== null && style !== void 0 ? style : undefined }, menuSections.map(section => (React.createElement(React.Fragment, { key: `section-${
|
3449
|
-
React.createElement("p", { key: `section-label-${
|
3450
|
-
React.createElement(MenuList, { key: `section-menu-list-${
|
3450
|
+
return (React.createElement("aside", { "data-testid": menuTestId, className: menuClasses, style: style !== null && style !== void 0 ? style : undefined }, menuSections.map(section => (React.createElement(React.Fragment, { key: `section-${generateKey()}` },
|
3451
|
+
React.createElement("p", { key: `section-label-${generateKey()}`, className: 'menu-label' }, section.label),
|
3452
|
+
React.createElement(MenuList, { key: `section-menu-list-${generateKey()}`, itemList: section.itemList }))))));
|
3451
3453
|
};
|
3452
3454
|
|
3453
3455
|
const renderEllipsis = (hasEllipsis) => hasEllipsis ? (React.createElement("li", null,
|
@@ -3472,7 +3474,7 @@ const renderPages = (pages, hasEllipsis, ellipsisItems) => {
|
|
3472
3474
|
}
|
3473
3475
|
if (!hasEllipsis ||
|
3474
3476
|
(pageIndex > ellipsisItems && pageIndex < lastEllipsisItemIndex)) {
|
3475
|
-
return (React.createElement(PaginationItem, Object.assign({ key: `pagination-item-${
|
3477
|
+
return (React.createElement(PaginationItem, Object.assign({ key: `pagination-item-${generateKey()}` }, pageItem)));
|
3476
3478
|
}
|
3477
3479
|
if (pageIndex === --length) {
|
3478
3480
|
return (React.createElement(React.Fragment, { key: `last-pagination-item` },
|
@@ -3544,7 +3546,7 @@ const Tabs = ({ testId = null, cssClasses = null, style = null, tabs, alignment
|
|
3544
3546
|
]);
|
3545
3547
|
const tabsTestId = testId !== null && testId !== void 0 ? testId : parseTestId({ tag: 'tabs', parsedClasses: tabsClasses });
|
3546
3548
|
return (React.createElement("section", { "data-testid": tabsTestId, className: tabsClasses, style: style !== null && style !== void 0 ? style : undefined },
|
3547
|
-
React.createElement("ul", null, tabs.map(tabConfig => (React.createElement("li", { key: `tab-item-${
|
3549
|
+
React.createElement("ul", null, tabs.map(tabConfig => (React.createElement("li", { key: `tab-item-${generateKey()}`, className: tabConfig.isActive ? 'is-active' : undefined }, React.createElement(TabItem, Object.assign({}, tabConfig))))))));
|
3548
3550
|
};
|
3549
3551
|
|
3550
3552
|
const renderIcon = (iconConfig) => iconConfig ? React.createElement(Icon, Object.assign({}, iconConfig)) : null;
|
@@ -3579,10 +3581,68 @@ const InputControl = ({ testId = null, cssClasses = null, style = null, inputCon
|
|
3579
3581
|
renderIcon(rightIcon ? Object.assign(Object.assign({}, rightIcon), { position: 'is-right' }) : undefined)));
|
3580
3582
|
};
|
3581
3583
|
|
3584
|
+
const convertConfigToComponent = ({ type, props }, testId, cssClasses, style, blockText) => {
|
3585
|
+
switch (type) {
|
3586
|
+
case 'icon': {
|
3587
|
+
const panelBlockIconClasses = parseClasses(['panel-icon', cssClasses]);
|
3588
|
+
const panelBlockIconTestId = testId !== null && testId !== void 0 ? testId : parseTestId({ tag: 'panel-icon', parsedClasses: panelBlockIconClasses });
|
3589
|
+
return (React.createElement(React.Fragment, null,
|
3590
|
+
React.createElement("span", { "data-testid": panelBlockIconTestId, className: panelBlockIconClasses, style: style !== null && style !== void 0 ? style : undefined },
|
3591
|
+
React.createElement(Icon, Object.assign({}, props))),
|
3592
|
+
blockText));
|
3593
|
+
}
|
3594
|
+
case 'control':
|
3595
|
+
return React.createElement(InputControl, Object.assign({}, props));
|
3596
|
+
case 'button':
|
3597
|
+
return React.createElement(Button, Object.assign({}, props));
|
3598
|
+
}
|
3599
|
+
};
|
3600
|
+
const PanelBlock = ({ testId = null, containerTestId = null, cssClasses = null, containerCssClasses = null, style = null, containerStyle = null, config, blockText = null, isActive = false, onClick }) => {
|
3601
|
+
const panelBlockLinkClasses = parseClasses([
|
3602
|
+
'panel-block',
|
3603
|
+
isActive ? 'is-active' : null,
|
3604
|
+
containerCssClasses
|
3605
|
+
]);
|
3606
|
+
const panelBlockLinkTestId = containerTestId !== null && containerTestId !== void 0 ? containerTestId : parseTestId({ tag: 'panel-block', parsedClasses: panelBlockLinkClasses });
|
3607
|
+
return (React.createElement("a", { "data-testid": panelBlockLinkTestId, className: panelBlockLinkClasses, style: containerStyle !== null && containerStyle !== void 0 ? containerStyle : undefined, "aria-hidden": 'true', onClick: onClick !== null && onClick !== void 0 ? onClick : undefined }, convertConfigToComponent(config, testId, cssClasses, style, blockText)));
|
3608
|
+
};
|
3609
|
+
|
3610
|
+
const PanelTabs = ({ testId = null, cssClasses = null, style = null, tabList }) => {
|
3611
|
+
const panelTabsClasses = parseClasses(['panel-tabs', cssClasses]);
|
3612
|
+
const panelTabsTestId = testId !== null && testId !== void 0 ? testId : parseTestId({ tag: 'panel-tabs', parsedClasses: panelTabsClasses });
|
3613
|
+
return (React.createElement("section", { "data-testid": panelTabsTestId, className: panelTabsClasses, style: style !== null && style !== void 0 ? style : undefined }, tabList.map(tabItem => {
|
3614
|
+
var _a;
|
3615
|
+
return (React.createElement("a", { key: `tab-item-${generateKey()}`, className: tabItem.isActive ? 'is-active' : undefined, "aria-hidden": 'true', onClick: (_a = tabItem.onClick) !== null && _a !== void 0 ? _a : undefined }, tabItem.text));
|
3616
|
+
})));
|
3617
|
+
};
|
3618
|
+
|
3619
|
+
const LevelItem = ({ testId = null, cssClasses = null, style = null, content, isCentered = false }) => {
|
3620
|
+
const levelItemClasses = parseClasses([
|
3621
|
+
'level-item',
|
3622
|
+
isCentered ? 'has-text-centered' : null,
|
3623
|
+
cssClasses
|
3624
|
+
]);
|
3625
|
+
const levelItemTestId = testId !== null && testId !== void 0 ? testId : parseTestId({
|
3626
|
+
tag: 'level-item',
|
3627
|
+
parsedClasses: levelItemClasses,
|
3628
|
+
rules: [
|
3629
|
+
{
|
3630
|
+
regExp: /is-|has-/gm,
|
3631
|
+
replacer: '-'
|
3632
|
+
},
|
3633
|
+
{
|
3634
|
+
regExp: /level-item/gm,
|
3635
|
+
replacer: ''
|
3636
|
+
}
|
3637
|
+
]
|
3638
|
+
});
|
3639
|
+
return (React.createElement("section", { "data-testid": levelItemTestId, className: levelItemClasses, style: style !== null && style !== void 0 ? style : undefined }, content));
|
3640
|
+
};
|
3641
|
+
|
3582
3642
|
const renderFieldLabel = (labelText) => labelText ? (React.createElement("label", { "data-testid": 'test-form-field-label', className: 'label' }, labelText)) : null;
|
3583
3643
|
const renderFieldBody = (inputControlConfig, isGrouped) => {
|
3584
3644
|
if (isGrouped) {
|
3585
|
-
return Array.isArray(inputControlConfig) ? (inputControlConfig.map((_singleConfig, i) => (React.createElement(InputControl, Object.assign({ key: `grouped-input-control-${
|
3645
|
+
return Array.isArray(inputControlConfig) ? (inputControlConfig.map((_singleConfig, i) => (React.createElement(InputControl, Object.assign({ key: `grouped-input-control-${generateKey()}`, testId: `test-grouped-input-control-${i}` }, _singleConfig))))) : (React.createElement(InputControl, Object.assign({}, inputControlConfig)));
|
3586
3646
|
}
|
3587
3647
|
else {
|
3588
3648
|
return Array.isArray(inputControlConfig) ? (React.createElement(InputControl, Object.assign({}, inputControlConfig[0]))) : (React.createElement(InputControl, Object.assign({}, inputControlConfig)));
|
@@ -3622,5 +3682,29 @@ const FormField = ({ testId = null, cssClasses = null, style = null, labelText =
|
|
3622
3682
|
renderFieldHelper(helperConfig)))));
|
3623
3683
|
};
|
3624
3684
|
|
3625
|
-
|
3685
|
+
const generateHeader = (headerText) => (React.createElement("p", { className: 'panel-heading' }, headerText));
|
3686
|
+
const Panel = ({ testId = null, cssClasses = null, style = null, headerText, panelTabs = null, blockList, color = null }) => {
|
3687
|
+
const panelClasses = parseClasses(['panel', color, cssClasses]);
|
3688
|
+
const panelTestId = testId !== null && testId !== void 0 ? testId : parseTestId({ tag: 'panel', parsedClasses: panelClasses });
|
3689
|
+
return (React.createElement("article", { "data-testid": panelTestId, className: panelClasses, style: style !== null && style !== void 0 ? style : undefined },
|
3690
|
+
generateHeader(headerText),
|
3691
|
+
panelTabs ? React.createElement(PanelTabs, Object.assign({}, panelTabs)) : null,
|
3692
|
+
blockList.map(blockConfig => (React.createElement(PanelBlock, Object.assign({ key: `panel-block-item-${generateKey()}` }, blockConfig))))));
|
3693
|
+
};
|
3694
|
+
|
3695
|
+
const renderLevelSection = (levelItemList) => levelItemList.map(_levelItemConfig => (React.createElement(LevelItem, Object.assign({ key: `level-item-${generateKey()}` }, _levelItemConfig))));
|
3696
|
+
const Level = ({ testId = null, cssClasses = null, style = null, leftSide = null, centerSide = null, rightSide = null, isMobile = false }) => {
|
3697
|
+
const levelClasses = parseClasses([
|
3698
|
+
'level',
|
3699
|
+
isMobile ? 'is-mobile' : null,
|
3700
|
+
cssClasses
|
3701
|
+
]);
|
3702
|
+
const levelTestId = testId !== null && testId !== void 0 ? testId : parseTestId({ tag: 'level', parsedClasses: levelClasses });
|
3703
|
+
return (React.createElement("nav", { "data-testid": levelTestId, className: levelClasses, style: style !== null && style !== void 0 ? style : undefined },
|
3704
|
+
leftSide ? (React.createElement("section", { className: 'level-left' }, renderLevelSection(leftSide))) : null,
|
3705
|
+
centerSide ? renderLevelSection(centerSide) : null,
|
3706
|
+
rightSide ? (React.createElement("section", { className: 'level-right' }, renderLevelSection(rightSide))) : null));
|
3707
|
+
};
|
3708
|
+
|
3709
|
+
export { Block, Box, BreadcrumbItem, Breadcrumbs, Button, ButtonGroup, CheckBox as Checkbox, Column, ColumnGroup, Delete, Dropdown, DropdownItem, DropdownTrigger, File, FormField, Icon, Image, Input, InputControl, Level, LevelHeader, LevelItem, Menu, MenuItem, MenuList, Message, Modal, Notification, Pagination, PaginationItem, Panel, PanelBlock, PanelTabs, ProgressBar, RadioButton, Select, TabItem, Tabs, Tag, TextArea, Title };
|
3626
3710
|
//# sourceMappingURL=index.js.map
|