reactive-bulma 2.11.0 → 2.12.0
Sign up to get free protection for your applications and to get access to all the features.
- package/LICENSE +1 -1
- package/dist/cjs/index.js +77 -34
- package/dist/cjs/index.js.map +1 -1
- 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 +2 -1
- package/dist/cjs/types/components/{molecules → organisms}/FormField/index.d.ts +1 -1
- package/dist/cjs/types/components/organisms/Panel/index.d.ts +4 -0
- package/dist/cjs/types/components/organisms/index.d.ts +2 -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 +2 -2
- package/dist/cjs/types/interfaces/moleculeProps.d.ts +23 -14
- package/dist/cjs/types/interfaces/organismProps.d.ts +29 -0
- package/dist/cjs/types/types/domTypes.d.ts +3 -2
- package/dist/esm/index.js +75 -35
- package/dist/esm/index.js.map +1 -1
- 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 +2 -1
- package/dist/esm/types/components/{molecules → organisms}/FormField/index.d.ts +1 -1
- package/dist/esm/types/components/organisms/Panel/index.d.ts +4 -0
- package/dist/esm/types/components/organisms/index.d.ts +2 -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 +2 -2
- package/dist/esm/types/interfaces/moleculeProps.d.ts +23 -14
- package/dist/esm/types/interfaces/organismProps.d.ts +29 -0
- package/dist/esm/types/types/domTypes.d.ts +3 -2
- package/dist/index.d.ts +59 -17
- package/package.json +11 -11
@@ -10,4 +10,5 @@ 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';
|
@@ -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 */
|
@@ -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,28 @@ 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
|
-
|
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;
|
149
166
|
}
|
150
|
-
export interface
|
151
|
-
/** `Attribute`
|
152
|
-
|
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;
|
167
|
+
export interface PanelTabsProps extends ElementProps {
|
168
|
+
/** `Attribute` `Required` A list of configuration objects that will render a set of tabs */
|
169
|
+
tabList: PanelTabItem[];
|
161
170
|
}
|
162
171
|
export {};
|
@@ -0,0 +1,29 @@
|
|
1
|
+
import { ElementProps } from './commonProps';
|
2
|
+
import { InputControlProps, 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
|
+
}
|
@@ -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,22 @@ 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 generateKey = (max = 5000, min = 1) => {
|
3288
|
+
max = Math.floor(max);
|
3289
|
+
min = Math.ceil(min);
|
3290
|
+
const secureRandomNumbers = new Uint32Array(1);
|
3291
|
+
window.crypto.getRandomValues(secureRandomNumbers);
|
3292
|
+
return Math.floor(secureRandomNumbers[0] * (max - min) + min).toString();
|
3298
3293
|
};
|
3299
3294
|
|
3300
3295
|
const ButtonGroup = ({ testId = null, cssClasses = null, style = null, buttonList, isAttached = false, position = 'left' }) => {
|
@@ -3323,7 +3318,7 @@ const ButtonGroup = ({ testId = null, cssClasses = null, style = null, buttonLis
|
|
3323
3318
|
const shouldApplyColor = (hasSelectedButton && currentButtonItem.isSelected) ||
|
3324
3319
|
!hasSelectedButton;
|
3325
3320
|
const buttonConfig = Object.assign(Object.assign({}, currentButtonItem), { color: shouldApplyColor ? currentButtonItem.color : undefined });
|
3326
|
-
return (React.createElement(Button, Object.assign({ key: `button-group-item-${
|
3321
|
+
return (React.createElement(Button, Object.assign({ key: `button-group-item-${generateKey()}` }, buttonConfig)));
|
3327
3322
|
})));
|
3328
3323
|
};
|
3329
3324
|
|
@@ -3351,7 +3346,7 @@ const ColumnGroup = ({ testId = null, cssClasses = null, style = null, listOfCol
|
|
3351
3346
|
tag: 'columns',
|
3352
3347
|
parsedClasses: columnGroupClasses
|
3353
3348
|
});
|
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-${
|
3349
|
+
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
3350
|
};
|
3356
3351
|
|
3357
3352
|
const Notification = ({ testId = null, cssClasses = null, style = null, children = null, deleteButton = null, color = null, isLightColor = null }) => {
|
@@ -3393,14 +3388,14 @@ const Breadcrumbs = ({ testId = 'breadcrumbs', containerTestId = null, cssClasse
|
|
3393
3388
|
]
|
3394
3389
|
});
|
3395
3390
|
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-${
|
3391
|
+
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
3392
|
};
|
3398
3393
|
|
3399
3394
|
const renderDropdownMenu = (items) => (React.createElement("section", { className: 'dropdown-content' }, items.map((dropdownItemConfig, i) => {
|
3400
3395
|
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-${
|
3396
|
+
return isFirstItemInMenu ? (React.createElement(DropdownItem, Object.assign({ key: `dropdown-item-${generateKey()}` }, dropdownItemConfig))) : (React.createElement("section", { key: `dropdown-item-${generateKey()}-section` },
|
3397
|
+
React.createElement(DropdownItem, { key: `dropdown-item-${generateKey()}-divider`, type: 'divider', itemText: 'divider' }),
|
3398
|
+
React.createElement(DropdownItem, Object.assign({ key: `dropdown-item-${generateKey()}` }, dropdownItemConfig))));
|
3404
3399
|
})));
|
3405
3400
|
const Dropdown = ({ testId = null, cssClasses = null, style = null, inputText, dropdownPointer = 'dropdown-menu', listOfItems }) => {
|
3406
3401
|
const [isMenuActive, setIsMenuActive] = reactExports.useState(false);
|
@@ -3432,12 +3427,12 @@ const MenuList = ({ testId = null, cssClasses = null, style = null, itemList })
|
|
3432
3427
|
const menuListTestId = testId !== null && testId !== void 0 ? testId : parseTestId({ tag: 'menu-list', parsedClasses: menuListClasses });
|
3433
3428
|
return (React.createElement("ul", { "data-testid": menuListTestId, className: menuListClasses, style: style !== null && style !== void 0 ? style : undefined }, itemList.map(item => {
|
3434
3429
|
if ('subListTitle' in item) {
|
3435
|
-
return (React.createElement("li", { key: `sub-list-menu-item-${
|
3430
|
+
return (React.createElement("li", { key: `sub-list-menu-item-${generateKey()}` },
|
3436
3431
|
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-${
|
3432
|
+
React.createElement("ul", null, item.subItems.map(subItem => (React.createElement(MenuItem, Object.assign({ key: `sub-list-menu-sub-item-${generateKey()}` }, subItem)))))));
|
3438
3433
|
}
|
3439
3434
|
else {
|
3440
|
-
return (React.createElement(MenuItem, Object.assign({ key: `sub-list-item-${
|
3435
|
+
return (React.createElement(MenuItem, Object.assign({ key: `sub-list-item-${generateKey()}` }, item)));
|
3441
3436
|
}
|
3442
3437
|
})));
|
3443
3438
|
};
|
@@ -3445,9 +3440,9 @@ const MenuList = ({ testId = null, cssClasses = null, style = null, itemList })
|
|
3445
3440
|
const Menu = ({ testId = null, cssClasses = null, style = null, menuSections }) => {
|
3446
3441
|
const menuClasses = parseClasses(['menu', cssClasses]);
|
3447
3442
|
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-${
|
3443
|
+
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()}` },
|
3444
|
+
React.createElement("p", { key: `section-label-${generateKey()}`, className: 'menu-label' }, section.label),
|
3445
|
+
React.createElement(MenuList, { key: `section-menu-list-${generateKey()}`, itemList: section.itemList }))))));
|
3451
3446
|
};
|
3452
3447
|
|
3453
3448
|
const renderEllipsis = (hasEllipsis) => hasEllipsis ? (React.createElement("li", null,
|
@@ -3472,7 +3467,7 @@ const renderPages = (pages, hasEllipsis, ellipsisItems) => {
|
|
3472
3467
|
}
|
3473
3468
|
if (!hasEllipsis ||
|
3474
3469
|
(pageIndex > ellipsisItems && pageIndex < lastEllipsisItemIndex)) {
|
3475
|
-
return (React.createElement(PaginationItem, Object.assign({ key: `pagination-item-${
|
3470
|
+
return (React.createElement(PaginationItem, Object.assign({ key: `pagination-item-${generateKey()}` }, pageItem)));
|
3476
3471
|
}
|
3477
3472
|
if (pageIndex === --length) {
|
3478
3473
|
return (React.createElement(React.Fragment, { key: `last-pagination-item` },
|
@@ -3544,7 +3539,7 @@ const Tabs = ({ testId = null, cssClasses = null, style = null, tabs, alignment
|
|
3544
3539
|
]);
|
3545
3540
|
const tabsTestId = testId !== null && testId !== void 0 ? testId : parseTestId({ tag: 'tabs', parsedClasses: tabsClasses });
|
3546
3541
|
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-${
|
3542
|
+
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
3543
|
};
|
3549
3544
|
|
3550
3545
|
const renderIcon = (iconConfig) => iconConfig ? React.createElement(Icon, Object.assign({}, iconConfig)) : null;
|
@@ -3579,10 +3574,45 @@ const InputControl = ({ testId = null, cssClasses = null, style = null, inputCon
|
|
3579
3574
|
renderIcon(rightIcon ? Object.assign(Object.assign({}, rightIcon), { position: 'is-right' }) : undefined)));
|
3580
3575
|
};
|
3581
3576
|
|
3577
|
+
const convertConfigToComponent = ({ type, props }, testId, cssClasses, style, blockText) => {
|
3578
|
+
switch (type) {
|
3579
|
+
case 'icon': {
|
3580
|
+
const panelBlockIconClasses = parseClasses(['panel-icon', cssClasses]);
|
3581
|
+
const panelBlockIconTestId = testId !== null && testId !== void 0 ? testId : parseTestId({ tag: 'panel-icon', parsedClasses: panelBlockIconClasses });
|
3582
|
+
return (React.createElement(React.Fragment, null,
|
3583
|
+
React.createElement("span", { "data-testid": panelBlockIconTestId, className: panelBlockIconClasses, style: style !== null && style !== void 0 ? style : undefined },
|
3584
|
+
React.createElement(Icon, Object.assign({}, props))),
|
3585
|
+
blockText));
|
3586
|
+
}
|
3587
|
+
case 'control':
|
3588
|
+
return React.createElement(InputControl, Object.assign({}, props));
|
3589
|
+
case 'button':
|
3590
|
+
return React.createElement(Button, Object.assign({}, props));
|
3591
|
+
}
|
3592
|
+
};
|
3593
|
+
const PanelBlock = ({ testId = null, containerTestId = null, cssClasses = null, containerCssClasses = null, style = null, containerStyle = null, config, blockText = null, isActive = false, onClick }) => {
|
3594
|
+
const panelBlockLinkClasses = parseClasses([
|
3595
|
+
'panel-block',
|
3596
|
+
isActive ? 'is-active' : null,
|
3597
|
+
containerCssClasses
|
3598
|
+
]);
|
3599
|
+
const panelBlockLinkTestId = containerTestId !== null && containerTestId !== void 0 ? containerTestId : parseTestId({ tag: 'panel-block', parsedClasses: panelBlockLinkClasses });
|
3600
|
+
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)));
|
3601
|
+
};
|
3602
|
+
|
3603
|
+
const PanelTabs = ({ testId = null, cssClasses = null, style = null, tabList }) => {
|
3604
|
+
const panelTabsClasses = parseClasses(['panel-tabs', cssClasses]);
|
3605
|
+
const panelTabsTestId = testId !== null && testId !== void 0 ? testId : parseTestId({ tag: 'panel-tabs', parsedClasses: panelTabsClasses });
|
3606
|
+
return (React.createElement("section", { "data-testid": panelTabsTestId, className: panelTabsClasses, style: style !== null && style !== void 0 ? style : undefined }, tabList.map(tabItem => {
|
3607
|
+
var _a;
|
3608
|
+
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));
|
3609
|
+
})));
|
3610
|
+
};
|
3611
|
+
|
3582
3612
|
const renderFieldLabel = (labelText) => labelText ? (React.createElement("label", { "data-testid": 'test-form-field-label', className: 'label' }, labelText)) : null;
|
3583
3613
|
const renderFieldBody = (inputControlConfig, isGrouped) => {
|
3584
3614
|
if (isGrouped) {
|
3585
|
-
return Array.isArray(inputControlConfig) ? (inputControlConfig.map((_singleConfig, i) => (React.createElement(InputControl, Object.assign({ key: `grouped-input-control-${
|
3615
|
+
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
3616
|
}
|
3587
3617
|
else {
|
3588
3618
|
return Array.isArray(inputControlConfig) ? (React.createElement(InputControl, Object.assign({}, inputControlConfig[0]))) : (React.createElement(InputControl, Object.assign({}, inputControlConfig)));
|
@@ -3622,5 +3652,15 @@ const FormField = ({ testId = null, cssClasses = null, style = null, labelText =
|
|
3622
3652
|
renderFieldHelper(helperConfig)))));
|
3623
3653
|
};
|
3624
3654
|
|
3625
|
-
|
3655
|
+
const generateHeader = (headerText) => (React.createElement("p", { className: 'panel-heading' }, headerText));
|
3656
|
+
const Panel = ({ testId = null, cssClasses = null, style = null, headerText, panelTabs = null, blockList, color = null }) => {
|
3657
|
+
const panelClasses = parseClasses(['panel', color, cssClasses]);
|
3658
|
+
const panelTestId = testId !== null && testId !== void 0 ? testId : parseTestId({ tag: 'panel', parsedClasses: panelClasses });
|
3659
|
+
return (React.createElement("article", { "data-testid": panelTestId, className: panelClasses, style: style !== null && style !== void 0 ? style : undefined },
|
3660
|
+
generateHeader(headerText),
|
3661
|
+
panelTabs ? React.createElement(PanelTabs, Object.assign({}, panelTabs)) : null,
|
3662
|
+
blockList.map(blockConfig => (React.createElement(PanelBlock, Object.assign({ key: `panel-block-item-${generateKey()}` }, blockConfig))))));
|
3663
|
+
};
|
3664
|
+
|
3665
|
+
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, Panel, PanelBlock, PanelTabs, ProgressBar, RadioButton, Select, TabItem, Tabs, Tag, TextArea, Title };
|
3626
3666
|
//# sourceMappingURL=index.js.map
|