reactive-bulma 2.6.0 → 2.7.0
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/cjs/index.js +54 -9
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/types/components/atoms/MenuItem/index.d.ts +4 -0
- package/dist/cjs/types/components/atoms/index.d.ts +1 -0
- package/dist/cjs/types/components/molecules/Menu/index.d.ts +4 -0
- package/dist/cjs/types/components/molecules/MenuList/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 -0
- package/dist/cjs/types/interfaces/atomProps.d.ts +6 -0
- package/dist/cjs/types/interfaces/moleculeProps.d.ts +21 -1
- package/dist/esm/index.js +52 -10
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/types/components/atoms/MenuItem/index.d.ts +4 -0
- package/dist/esm/types/components/atoms/index.d.ts +1 -0
- package/dist/esm/types/components/molecules/Menu/index.d.ts +4 -0
- package/dist/esm/types/components/molecules/MenuList/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 -0
- package/dist/esm/types/interfaces/atomProps.d.ts +6 -0
- package/dist/esm/types/interfaces/moleculeProps.d.ts +21 -1
- package/dist/index.d.ts +32 -1
- package/package.json +11 -11
package/dist/cjs/index.js
CHANGED
@@ -1,5 +1,7 @@
|
|
1
1
|
'use strict';
|
2
2
|
|
3
|
+
var crypto = require('crypto');
|
4
|
+
|
3
5
|
function styleInject(css, ref) {
|
4
6
|
if ( ref === void 0 ) ref = {};
|
5
7
|
var insertAt = ref.insertAt;
|
@@ -2861,6 +2863,13 @@ const parseTestId = (config) => {
|
|
2861
2863
|
}
|
2862
2864
|
return `test-${config.tag}${fixedClassString.replace(/ /gm, (_a = config.separator) !== null && _a !== void 0 ? _a : '')}`;
|
2863
2865
|
};
|
2866
|
+
const parseKey = (max = 5000, min = 1) => {
|
2867
|
+
max = Math.floor(max);
|
2868
|
+
min = Math.ceil(min);
|
2869
|
+
const secureRandomNumbers = new Uint32Array(1);
|
2870
|
+
crypto.getRandomValues(secureRandomNumbers);
|
2871
|
+
return Math.floor(secureRandomNumbers[0] * (max - min) + min).toString();
|
2872
|
+
};
|
2864
2873
|
|
2865
2874
|
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 }) => {
|
2866
2875
|
const buttonClasses = parseClasses([
|
@@ -2935,7 +2944,7 @@ const Tag = ({ testId = null, containerTestId = null, cssClasses = null, contain
|
|
2935
2944
|
const tagDeleteTestId = `${tagTestId}-delete`;
|
2936
2945
|
return withAddon ? (React.createElement("section", { "data-testid": tagContainerTestId, style: containerStyle !== null && containerStyle !== void 0 ? containerStyle : undefined, className: tagContainerClasses },
|
2937
2946
|
React.createElement("span", { "data-testid": tagTestId, className: tagClasses }, text),
|
2938
|
-
withDelete ? (React.createElement("a", { "data-testid": tagDeleteTestId, className: 'tag is-delete', onClick: onDeleteClick !== null && onDeleteClick !== void 0 ? onDeleteClick : undefined })) : (React.createElement("span", { className: tagAddonClasses }, addonText)))) : (React.createElement("span", { "data-testid": tagTestId, style: style !== null && style !== void 0 ? style : undefined, className: tagClasses },
|
2947
|
+
withDelete ? (React.createElement("a", { "data-testid": tagDeleteTestId, className: 'tag is-delete', "aria-hidden": 'true', onClick: onDeleteClick !== null && onDeleteClick !== void 0 ? onDeleteClick : undefined })) : (React.createElement("span", { className: tagAddonClasses }, addonText)))) : (React.createElement("span", { "data-testid": tagTestId, style: style !== null && style !== void 0 ? style : undefined, className: tagClasses },
|
2939
2948
|
text,
|
2940
2949
|
withDelete ? (React.createElement("button", { "data-testid": tagDeleteTestId, className: 'delete', onClick: onDeleteClick !== null && onDeleteClick !== void 0 ? onDeleteClick : undefined })) : null));
|
2941
2950
|
};
|
@@ -3186,7 +3195,7 @@ const BreadcrumbItem = ({ testId = null, containerTestId = null, cssClasses = nu
|
|
3186
3195
|
});
|
3187
3196
|
const breadcrumbItemTestId = testId !== null && testId !== void 0 ? testId : parseTestId({ tag: 'breadcrumbItem', parsedClasses: breadcrumbItemClasses });
|
3188
3197
|
return (React.createElement("li", { "data-testid": breadcrumbItemContainerTestId, className: breadcrumbItemContainerClasses, style: containerStyle !== null && containerStyle !== void 0 ? containerStyle : undefined },
|
3189
|
-
React.createElement("a", { "data-testid": breadcrumbItemTestId, className: breadcrumbItemClasses, style: style !== null && style !== void 0 ? style : undefined, onClick: onClick !== null && onClick !== void 0 ? onClick : undefined }, text)));
|
3198
|
+
React.createElement("a", { "data-testid": breadcrumbItemTestId, className: breadcrumbItemClasses, style: style !== null && style !== void 0 ? style : undefined, "aria-hidden": 'true', onClick: onClick !== null && onClick !== void 0 ? onClick : undefined }, text)));
|
3190
3199
|
};
|
3191
3200
|
|
3192
3201
|
const DropdownTrigger = ({ testId = null, containerTestId = null, cssClasses = null, containerCssClasses = null, style = null, containerStyle = null, menuText, dropdownPointer = 'dropdown-menu', onClick = null }) => {
|
@@ -3236,6 +3245,16 @@ const DropdownItem = ({ testId = null, cssClasses = null, style = null, itemText
|
|
3236
3245
|
}
|
3237
3246
|
};
|
3238
3247
|
|
3248
|
+
const MenuItem = ({ testId = null, cssClasses = null, style = null, text, isActive = null, onClick = null }) => {
|
3249
|
+
const menuItemClasses = parseClasses([
|
3250
|
+
'menuItem',
|
3251
|
+
isActive ? 'is-active' : null,
|
3252
|
+
cssClasses
|
3253
|
+
]);
|
3254
|
+
const menuItemTestId = testId !== null && testId !== void 0 ? testId : parseTestId({ tag: 'menuItem', parsedClasses: menuItemClasses });
|
3255
|
+
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));
|
3256
|
+
};
|
3257
|
+
|
3239
3258
|
const ButtonGroup = ({ testId = null, cssClasses = null, style = null, buttonList, isAttached = false, position = 'left' }) => {
|
3240
3259
|
const buttonGroupClasses = parseClasses([
|
3241
3260
|
'buttons',
|
@@ -3257,12 +3276,12 @@ const ButtonGroup = ({ testId = null, cssClasses = null, style = null, buttonLis
|
|
3257
3276
|
}
|
3258
3277
|
]
|
3259
3278
|
});
|
3260
|
-
return (React.createElement("section", { "data-testid": buttonGroupTestId, className: buttonGroupClasses, style: style !== null && style !== void 0 ? style : undefined }, buttonList.map((currentButtonItem,
|
3279
|
+
return (React.createElement("section", { "data-testid": buttonGroupTestId, className: buttonGroupClasses, style: style !== null && style !== void 0 ? style : undefined }, buttonList.map((currentButtonItem, _, originalButtonList) => {
|
3261
3280
|
const hasSelectedButton = originalButtonList.some(({ isSelected }) => isSelected);
|
3262
3281
|
const shouldApplyColor = (hasSelectedButton && currentButtonItem.isSelected) ||
|
3263
3282
|
!hasSelectedButton;
|
3264
3283
|
const buttonConfig = Object.assign(Object.assign({}, currentButtonItem), { color: shouldApplyColor ? currentButtonItem.color : undefined });
|
3265
|
-
return (React.createElement(Button, Object.assign({ key: `button-group-item-${
|
3284
|
+
return (React.createElement(Button, Object.assign({ key: `button-group-item-${parseKey()}` }, buttonConfig)));
|
3266
3285
|
})));
|
3267
3286
|
};
|
3268
3287
|
|
@@ -3290,7 +3309,7 @@ const ColumnGroup = ({ testId = null, cssClasses = null, style = null, listOfCol
|
|
3290
3309
|
tag: 'columns',
|
3291
3310
|
parsedClasses: columnGroupClasses
|
3292
3311
|
});
|
3293
|
-
return (React.createElement("section", { "data-testid": columnGroupTestId, className: columnGroupClasses, style: style !== null && style !== void 0 ? style : undefined }, listOfColumns.map(
|
3312
|
+
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-${parseKey()}` }, columnItemConfig))))));
|
3294
3313
|
};
|
3295
3314
|
|
3296
3315
|
const Notification = ({ testId = null, cssClasses = null, style = null, children = null, deleteButton = null, color = null, isLightColor = null }) => {
|
@@ -3332,14 +3351,14 @@ const Breadcrumbs = ({ testId = 'breadcrumbs', containerTestId = null, cssClasse
|
|
3332
3351
|
]
|
3333
3352
|
});
|
3334
3353
|
return (React.createElement("nav", { "data-testid": breadcrumbsContainerTestId, className: breadcrumbsContainerClasses, style: containerStyle !== null && containerStyle !== void 0 ? containerStyle : undefined },
|
3335
|
-
React.createElement("ul", { "data-testid": testId, className: cssClasses !== null && cssClasses !== void 0 ? cssClasses : undefined, style: style !== null && style !== void 0 ? style : undefined }, items.map(
|
3354
|
+
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-${parseKey()}` }, itemConfig)))))));
|
3336
3355
|
};
|
3337
3356
|
|
3338
3357
|
const renderDropdownMenu = (items) => (React.createElement("section", { className: 'dropdown-content' }, items.map((dropdownItemConfig, i) => {
|
3339
3358
|
const isFirstItemInMenu = items.length > 1 && i === 0;
|
3340
|
-
return isFirstItemInMenu ? (React.createElement(DropdownItem, Object.assign({ key: `dropdown-item-${
|
3341
|
-
React.createElement(DropdownItem, { key: `dropdown-item-${
|
3342
|
-
React.createElement(DropdownItem, Object.assign({ key: `dropdown-item-${
|
3359
|
+
return isFirstItemInMenu ? (React.createElement(DropdownItem, Object.assign({ key: `dropdown-item-${parseKey()}` }, dropdownItemConfig))) : (React.createElement("section", { key: `dropdown-item-${parseKey()}-section` },
|
3360
|
+
React.createElement(DropdownItem, { key: `dropdown-item-${parseKey()}-divider`, type: 'divider', itemText: 'divider' }),
|
3361
|
+
React.createElement(DropdownItem, Object.assign({ key: `dropdown-item-${parseKey()}` }, dropdownItemConfig))));
|
3343
3362
|
})));
|
3344
3363
|
const Dropdown = ({ testId = null, cssClasses = null, style = null, inputText, dropdownPointer = 'dropdown-menu', listOfItems }) => {
|
3345
3364
|
const [isMenuActive, setIsMenuActive] = reactExports.useState(false);
|
@@ -3366,6 +3385,29 @@ const Message = ({ testId = null, cssClasses = null, style = null, headerText =
|
|
3366
3385
|
React.createElement("section", { "data-testid": `${messageTestId}-body`, className: 'message-body' }, bodyText)));
|
3367
3386
|
};
|
3368
3387
|
|
3388
|
+
const MenuList = ({ testId = null, cssClasses = null, style = null, itemList }) => {
|
3389
|
+
const menuListClasses = parseClasses(['menu-list', cssClasses]);
|
3390
|
+
const menuListTestId = testId !== null && testId !== void 0 ? testId : parseTestId({ tag: 'menu-list', parsedClasses: menuListClasses });
|
3391
|
+
return (React.createElement("ul", { "data-testid": menuListTestId, className: menuListClasses, style: style !== null && style !== void 0 ? style : undefined }, itemList.map(item => {
|
3392
|
+
if ('subListTitle' in item) {
|
3393
|
+
return (React.createElement("li", { key: `sub-list-menu-item-${parseKey()}` },
|
3394
|
+
React.createElement(MenuItem, Object.assign({}, item.subListTitle)),
|
3395
|
+
React.createElement("ul", null, item.subItems.map(subItem => (React.createElement(MenuItem, Object.assign({ key: `sub-list-menu-sub-item-${parseKey()}` }, subItem)))))));
|
3396
|
+
}
|
3397
|
+
else {
|
3398
|
+
return (React.createElement(MenuItem, Object.assign({ key: `sub-list-item-${parseKey()}` }, item)));
|
3399
|
+
}
|
3400
|
+
})));
|
3401
|
+
};
|
3402
|
+
|
3403
|
+
const Menu = ({ testId = null, cssClasses = null, style = null, menuSections }) => {
|
3404
|
+
const menuClasses = parseClasses(['menu', cssClasses]);
|
3405
|
+
const menuTestId = testId !== null && testId !== void 0 ? testId : parseTestId({ tag: 'menu', parsedClasses: menuClasses });
|
3406
|
+
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-${parseKey()}` },
|
3407
|
+
React.createElement("p", { key: `section-label-${parseKey()}`, className: 'menu-label' }, section.label),
|
3408
|
+
React.createElement(MenuList, { key: `section-menu-list-${parseKey()}`, itemList: section.itemList }))))));
|
3409
|
+
};
|
3410
|
+
|
3369
3411
|
exports.Block = Block;
|
3370
3412
|
exports.Box = Box;
|
3371
3413
|
exports.BreadcrumbItem = BreadcrumbItem;
|
@@ -3382,6 +3424,9 @@ exports.DropdownTrigger = DropdownTrigger;
|
|
3382
3424
|
exports.File = File;
|
3383
3425
|
exports.Icon = Icon;
|
3384
3426
|
exports.Input = Input;
|
3427
|
+
exports.Menu = Menu;
|
3428
|
+
exports.MenuItem = MenuItem;
|
3429
|
+
exports.MenuList = MenuList;
|
3385
3430
|
exports.Message = Message;
|
3386
3431
|
exports.Notification = Notification;
|
3387
3432
|
exports.ProgressBar = ProgressBar;
|