reactive-bulma 2.7.0 → 2.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/index.js +120 -8
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/types/components/atoms/PaginationItem/index.d.ts +4 -0
- package/dist/cjs/types/components/atoms/index.d.ts +2 -0
- package/dist/cjs/types/components/molecules/Modal/index.d.ts +4 -0
- package/dist/cjs/types/components/molecules/Pagination/index.d.ts +4 -0
- package/dist/cjs/types/components/molecules/index.d.ts +2 -0
- package/dist/cjs/types/interfaces/atomProps.d.ts +14 -4
- package/dist/cjs/types/interfaces/moleculeProps.d.ts +38 -6
- package/dist/cjs/types/types/styleTypes.d.ts +2 -1
- package/dist/esm/index.js +117 -9
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/types/components/atoms/PaginationItem/index.d.ts +4 -0
- package/dist/esm/types/components/atoms/index.d.ts +2 -0
- package/dist/esm/types/components/molecules/Modal/index.d.ts +4 -0
- package/dist/esm/types/components/molecules/Pagination/index.d.ts +4 -0
- package/dist/esm/types/components/molecules/index.d.ts +2 -0
- package/dist/esm/types/interfaces/atomProps.d.ts +14 -4
- package/dist/esm/types/interfaces/moleculeProps.d.ts +38 -6
- package/dist/esm/types/types/styleTypes.d.ts +2 -1
- package/dist/index.d.ts +68 -8
- package/package.json +29 -29
package/dist/cjs/index.js
CHANGED
@@ -1,7 +1,5 @@
|
|
1
1
|
'use strict';
|
2
2
|
|
3
|
-
var crypto = require('crypto');
|
4
|
-
|
5
3
|
function styleInject(css, ref) {
|
6
4
|
if ( ref === void 0 ) ref = {};
|
7
5
|
var insertAt = ref.insertAt;
|
@@ -2867,7 +2865,7 @@ const parseKey = (max = 5000, min = 1) => {
|
|
2867
2865
|
max = Math.floor(max);
|
2868
2866
|
min = Math.ceil(min);
|
2869
2867
|
const secureRandomNumbers = new Uint32Array(1);
|
2870
|
-
crypto.getRandomValues(secureRandomNumbers);
|
2868
|
+
window.crypto.getRandomValues(secureRandomNumbers);
|
2871
2869
|
return Math.floor(secureRandomNumbers[0] * (max - min) + min).toString();
|
2872
2870
|
};
|
2873
2871
|
|
@@ -2944,7 +2942,7 @@ const Tag = ({ testId = null, containerTestId = null, cssClasses = null, contain
|
|
2944
2942
|
const tagDeleteTestId = `${tagTestId}-delete`;
|
2945
2943
|
return withAddon ? (React.createElement("section", { "data-testid": tagContainerTestId, style: containerStyle !== null && containerStyle !== void 0 ? containerStyle : undefined, className: tagContainerClasses },
|
2946
2944
|
React.createElement("span", { "data-testid": tagTestId, className: tagClasses }, text),
|
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 },
|
2945
|
+
withDelete ? (React.createElement("a", { "data-testid": tagDeleteTestId, className: 'tag is-delete', title: '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 },
|
2948
2946
|
text,
|
2949
2947
|
withDelete ? (React.createElement("button", { "data-testid": tagDeleteTestId, className: 'delete', onClick: onDeleteClick !== null && onDeleteClick !== void 0 ? onDeleteClick : undefined })) : null));
|
2950
2948
|
};
|
@@ -2953,8 +2951,6 @@ const Box = ({ testId = 'test-box', cssClasses = 'box', style = null, children =
|
|
2953
2951
|
|
2954
2952
|
const renderTitleSection = (section) => {
|
2955
2953
|
var _a, _b;
|
2956
|
-
if (!section)
|
2957
|
-
return null;
|
2958
2954
|
const { type, size, isSpaced, cssClasses } = section;
|
2959
2955
|
const sectionClasses = parseClasses([
|
2960
2956
|
type,
|
@@ -2966,8 +2962,8 @@ const renderTitleSection = (section) => {
|
|
2966
2962
|
return (React.createElement("p", { "data-testid": sectionTestId, className: sectionClasses, style: (_b = section === null || section === void 0 ? void 0 : section.style) !== null && _b !== void 0 ? _b : undefined }, section === null || section === void 0 ? void 0 : section.text));
|
2967
2963
|
};
|
2968
2964
|
const Title = ({ main, secondary }) => (React.createElement(React.Fragment, null,
|
2969
|
-
renderTitleSection(main),
|
2970
|
-
renderTitleSection(secondary)));
|
2965
|
+
main ? renderTitleSection(main) : null,
|
2966
|
+
secondary ? renderTitleSection(secondary) : null));
|
2971
2967
|
|
2972
2968
|
var IconSizeEnum;
|
2973
2969
|
(function (IconSizeEnum) {
|
@@ -3255,6 +3251,36 @@ const MenuItem = ({ testId = null, cssClasses = null, style = null, text, isActi
|
|
3255
3251
|
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
3252
|
};
|
3257
3253
|
|
3254
|
+
const Image = ({ testId = null, containerTestId = null, cssClasses = null, containerCssClasses = null, style = null, containerStyle = null, src, fixedSize = 'is-1by1', isRounded = false }) => {
|
3255
|
+
const imageContainerClasses = parseClasses([
|
3256
|
+
'image',
|
3257
|
+
fixedSize,
|
3258
|
+
containerCssClasses
|
3259
|
+
]);
|
3260
|
+
const imageClasses = parseClasses([
|
3261
|
+
isRounded ? 'is-rounded' : null,
|
3262
|
+
cssClasses
|
3263
|
+
]);
|
3264
|
+
const imageContainerTestId = containerTestId !== null && containerTestId !== void 0 ? containerTestId : parseTestId({ tag: 'image', parsedClasses: imageContainerClasses });
|
3265
|
+
const imageTestId = testId !== null && testId !== void 0 ? testId : `${imageContainerTestId}-img`;
|
3266
|
+
return (React.createElement("figure", { "data-testid": imageContainerTestId, className: imageContainerClasses, style: containerStyle !== null && containerStyle !== void 0 ? containerStyle : undefined },
|
3267
|
+
React.createElement("img", { "data-testid": imageTestId, className: imageClasses, style: style !== null && style !== void 0 ? style : undefined, src: src })));
|
3268
|
+
};
|
3269
|
+
|
3270
|
+
const PaginationItem = ({ testId = null, cssClasses = null, style = null, text, labelText = 'Page', currentLabelText = 'Go to page', isSelected = null, onClick = null }) => {
|
3271
|
+
const paginationItemClasses = parseClasses([
|
3272
|
+
'pagination-link',
|
3273
|
+
isSelected ? 'is-current' : null,
|
3274
|
+
cssClasses
|
3275
|
+
]);
|
3276
|
+
const paginationItemTestId = testId !== null && testId !== void 0 ? testId : parseTestId({
|
3277
|
+
tag: 'pagination-link',
|
3278
|
+
parsedClasses: paginationItemClasses
|
3279
|
+
});
|
3280
|
+
const parsedLabelText = isSelected ? currentLabelText : labelText;
|
3281
|
+
return (React.createElement("a", { "data-testid": paginationItemTestId, className: paginationItemClasses, style: style !== null && style !== void 0 ? style : undefined, "aria-label": `${parsedLabelText} ${text}`, "aria-current": isSelected ? 'page' : undefined, "aria-hidden": 'true', onClick: onClick !== null && onClick !== void 0 ? onClick : undefined }, text));
|
3282
|
+
};
|
3283
|
+
|
3258
3284
|
const ButtonGroup = ({ testId = null, cssClasses = null, style = null, buttonList, isAttached = false, position = 'left' }) => {
|
3259
3285
|
const buttonGroupClasses = parseClasses([
|
3260
3286
|
'buttons',
|
@@ -3408,6 +3434,88 @@ const Menu = ({ testId = null, cssClasses = null, style = null, menuSections })
|
|
3408
3434
|
React.createElement(MenuList, { key: `section-menu-list-${parseKey()}`, itemList: section.itemList }))))));
|
3409
3435
|
};
|
3410
3436
|
|
3437
|
+
const renderEllipsis = (hasEllipsis) => hasEllipsis ? (React.createElement("li", null,
|
3438
|
+
React.createElement("span", { "aria-hidden": 'true', className: 'pagination-ellipsis' }, "\u2026"))) : null;
|
3439
|
+
const renderNavigationButton = (navigationButton) => {
|
3440
|
+
var _a;
|
3441
|
+
if (!navigationButton)
|
3442
|
+
return null;
|
3443
|
+
const navigationButtonClasses = parseClasses([
|
3444
|
+
navigationButton.cssClasses,
|
3445
|
+
navigationButton.isDisabled ? 'is-disabled' : null
|
3446
|
+
]);
|
3447
|
+
return (React.createElement("a", { className: navigationButtonClasses, onClick: (_a = navigationButton.onClick) !== null && _a !== void 0 ? _a : undefined, "aria-hidden": 'true' }, navigationButton.text));
|
3448
|
+
};
|
3449
|
+
const renderPages = (pages, hasEllipsis, ellipsisItems) => {
|
3450
|
+
return pages.map((pageItem, pageIndex, { length }) => {
|
3451
|
+
const lastEllipsisItemIndex = length - ellipsisItems - 1;
|
3452
|
+
if (pageIndex === 0) {
|
3453
|
+
return (React.createElement(React.Fragment, { key: `first-pagination-item` },
|
3454
|
+
React.createElement(PaginationItem, Object.assign({}, pageItem)),
|
3455
|
+
renderEllipsis(hasEllipsis)));
|
3456
|
+
}
|
3457
|
+
if (!hasEllipsis ||
|
3458
|
+
(pageIndex > ellipsisItems && pageIndex < lastEllipsisItemIndex)) {
|
3459
|
+
return (React.createElement(PaginationItem, Object.assign({ key: `pagination-item-${parseKey()}` }, pageItem)));
|
3460
|
+
}
|
3461
|
+
if (pageIndex === --length) {
|
3462
|
+
return (React.createElement(React.Fragment, { key: `last-pagination-item` },
|
3463
|
+
renderEllipsis(hasEllipsis),
|
3464
|
+
React.createElement(PaginationItem, Object.assign({}, pageItem))));
|
3465
|
+
}
|
3466
|
+
});
|
3467
|
+
};
|
3468
|
+
const Pagination = ({ testId = null, containerTestId = null, cssClasses = null, containerCssClasses = null, style = null, containerStyle = null, pages, ellipsisItems = 0, showPreviousPageButton = {
|
3469
|
+
text: 'Previous',
|
3470
|
+
cssClasses: 'pagination-previous'
|
3471
|
+
}, showNextPageButton = {
|
3472
|
+
text: 'Next page',
|
3473
|
+
cssClasses: 'pagination-next'
|
3474
|
+
}, hasEllipsis = false, isRounded = false, alignment = null, size = null }) => {
|
3475
|
+
const paginationContainerClasses = parseClasses([
|
3476
|
+
'pagination',
|
3477
|
+
isRounded ? 'is-rounded' : null,
|
3478
|
+
size,
|
3479
|
+
alignment,
|
3480
|
+
cssClasses
|
3481
|
+
]);
|
3482
|
+
const paginationContainerTestId = testId !== null && testId !== void 0 ? testId : parseTestId({
|
3483
|
+
tag: 'pagination',
|
3484
|
+
parsedClasses: paginationContainerClasses
|
3485
|
+
});
|
3486
|
+
const paginationClasses = parseClasses([
|
3487
|
+
'pagination-list',
|
3488
|
+
containerCssClasses
|
3489
|
+
]);
|
3490
|
+
const paginationTestId = containerTestId !== null && containerTestId !== void 0 ? containerTestId : parseTestId({ tag: 'pagination-list', parsedClasses: paginationClasses });
|
3491
|
+
return (React.createElement("nav", { "data-testid": paginationContainerTestId, className: paginationContainerClasses, style: containerStyle !== null && containerStyle !== void 0 ? containerStyle : undefined, role: 'navigation', "aria-label": 'pagination' },
|
3492
|
+
renderNavigationButton(showPreviousPageButton),
|
3493
|
+
renderNavigationButton(showNextPageButton),
|
3494
|
+
React.createElement("ul", { "data-testid": paginationTestId, className: paginationClasses, style: style !== null && style !== void 0 ? style : undefined }, renderPages(pages, hasEllipsis, ellipsisItems))));
|
3495
|
+
};
|
3496
|
+
|
3497
|
+
const Modal = ({ testId = null, containerTestId = null, cssClasses = null, containerCssClasses = null, style = null, containerStyle = null, children = null, onCloseClick = null }) => {
|
3498
|
+
const [modalIsOpen, setModalIsOpen] = reactExports.useState(true);
|
3499
|
+
const modalContainerClasses = parseClasses([
|
3500
|
+
'modal',
|
3501
|
+
'is-active',
|
3502
|
+
containerCssClasses
|
3503
|
+
]);
|
3504
|
+
const modalContainerTestId = containerTestId !== null && containerTestId !== void 0 ? containerTestId : parseTestId({ tag: 'modal', parsedClasses: modalContainerClasses });
|
3505
|
+
const modalClasses = parseClasses(['modal-content', cssClasses]);
|
3506
|
+
const modalTestId = testId !== null && testId !== void 0 ? testId : parseTestId({ tag: 'modal-content', parsedClasses: modalClasses });
|
3507
|
+
const handleCloseClick = () => {
|
3508
|
+
if (onCloseClick)
|
3509
|
+
onCloseClick();
|
3510
|
+
setModalIsOpen(false);
|
3511
|
+
};
|
3512
|
+
return (children &&
|
3513
|
+
modalIsOpen && (React.createElement("section", { "data-testid": modalContainerTestId, className: modalContainerClasses, style: containerStyle !== null && containerStyle !== void 0 ? containerStyle : undefined },
|
3514
|
+
React.createElement("section", { "data-testid": 'test-modal-background', className: 'modal-background', "aria-hidden": 'true', onClick: handleCloseClick }),
|
3515
|
+
React.createElement("section", { "data-testid": modalTestId, className: modalClasses, style: style !== null && style !== void 0 ? style : undefined }, children),
|
3516
|
+
React.createElement("button", { "data-testid": 'test-modal-close', className: 'modal-close is-large', "aria-label": 'close', onClick: handleCloseClick }))));
|
3517
|
+
};
|
3518
|
+
|
3411
3519
|
exports.Block = Block;
|
3412
3520
|
exports.Box = Box;
|
3413
3521
|
exports.BreadcrumbItem = BreadcrumbItem;
|
@@ -3423,12 +3531,16 @@ exports.DropdownItem = DropdownItem;
|
|
3423
3531
|
exports.DropdownTrigger = DropdownTrigger;
|
3424
3532
|
exports.File = File;
|
3425
3533
|
exports.Icon = Icon;
|
3534
|
+
exports.Image = Image;
|
3426
3535
|
exports.Input = Input;
|
3427
3536
|
exports.Menu = Menu;
|
3428
3537
|
exports.MenuItem = MenuItem;
|
3429
3538
|
exports.MenuList = MenuList;
|
3430
3539
|
exports.Message = Message;
|
3540
|
+
exports.Modal = Modal;
|
3431
3541
|
exports.Notification = Notification;
|
3542
|
+
exports.Pagination = Pagination;
|
3543
|
+
exports.PaginationItem = PaginationItem;
|
3432
3544
|
exports.ProgressBar = ProgressBar;
|
3433
3545
|
exports.RadioButton = RadioButton;
|
3434
3546
|
exports.Select = Select;
|