reactive-bulma 2.8.0 → 2.9.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -17,4 +17,5 @@ export { default as BreadcrumbItem } from './BreadcrumbItem';
17
17
  export { default as DropdownTrigger } from './DropdownTrigger';
18
18
  export { default as DropdownItem } from './DropdownItem';
19
19
  export { default as MenuItem } from './MenuItem';
20
+ export { default as Image } from './Image';
20
21
  export { default as PaginationItem } from './PaginationItem';
@@ -0,0 +1,4 @@
1
+ import React from 'react';
2
+ import { ModalProps } from '../../../interfaces/moleculeProps';
3
+ declare const Modal: React.FC<ModalProps>;
4
+ export default Modal;
@@ -7,3 +7,4 @@ export { default as Message } from './Message';
7
7
  export { default as Menu } from './Menu';
8
8
  export { default as MenuList } from './MenuList';
9
9
  export { default as Pagination } from './Pagination';
10
+ export { default as Modal } from './Modal';
@@ -109,4 +109,10 @@ export interface PaginationProps extends ComposedElementProps {
109
109
  /** `Styling` Will adjust the pages position on screen */
110
110
  alignment?: elementAlignType | null;
111
111
  }
112
+ export interface ModalProps extends ComposedElementProps {
113
+ /** `Attribute` Reffers to the component or array of components that will be shown inside the column */
114
+ children?: string | React.ReactElement | React.ReactElement[] | null;
115
+ /** `Function` Custom function related to the modal's close button to inject custom code if needed */
116
+ onCloseClick?: () => void;
117
+ }
112
118
  export {};
package/dist/esm/index.js CHANGED
@@ -3249,6 +3249,22 @@ const MenuItem = ({ testId = null, cssClasses = null, style = null, text, isActi
3249
3249
  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
3250
  };
3251
3251
 
3252
+ const Image = ({ testId = null, containerTestId = null, cssClasses = null, containerCssClasses = null, style = null, containerStyle = null, src, fixedSize = 'is-1by1', isRounded = false }) => {
3253
+ const imageContainerClasses = parseClasses([
3254
+ 'image',
3255
+ fixedSize,
3256
+ containerCssClasses
3257
+ ]);
3258
+ const imageClasses = parseClasses([
3259
+ isRounded ? 'is-rounded' : null,
3260
+ cssClasses
3261
+ ]);
3262
+ const imageContainerTestId = containerTestId !== null && containerTestId !== void 0 ? containerTestId : parseTestId({ tag: 'image', parsedClasses: imageContainerClasses });
3263
+ const imageTestId = testId !== null && testId !== void 0 ? testId : `${imageContainerTestId}-img`;
3264
+ 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
+ };
3267
+
3252
3268
  const PaginationItem = ({ testId = null, cssClasses = null, style = null, text, labelText = 'Page', currentLabelText = 'Go to page', isSelected = null, onClick = null }) => {
3253
3269
  const paginationItemClasses = parseClasses([
3254
3270
  'pagination-link',
@@ -3476,5 +3492,27 @@ const Pagination = ({ testId = null, containerTestId = null, cssClasses = null,
3476
3492
  React.createElement("ul", { "data-testid": paginationTestId, className: paginationClasses, style: style !== null && style !== void 0 ? style : undefined }, renderPages(pages, hasEllipsis, ellipsisItems))));
3477
3493
  };
3478
3494
 
3479
- export { Block, Box, BreadcrumbItem, Breadcrumbs, Button, ButtonGroup, CheckBox as Checkbox, Column, ColumnGroup, Delete, Dropdown, DropdownItem, DropdownTrigger, File, Icon, Input, Menu, MenuItem, MenuList, Message, Notification, Pagination, PaginationItem, ProgressBar, RadioButton, Select, Tag, TextArea, Title };
3495
+ const Modal = ({ testId = null, containerTestId = null, cssClasses = null, containerCssClasses = null, style = null, containerStyle = null, children = null, onCloseClick = null }) => {
3496
+ const [modalIsOpen, setModalIsOpen] = reactExports.useState(true);
3497
+ const modalContainerClasses = parseClasses([
3498
+ 'modal',
3499
+ 'is-active',
3500
+ containerCssClasses
3501
+ ]);
3502
+ const modalContainerTestId = containerTestId !== null && containerTestId !== void 0 ? containerTestId : parseTestId({ tag: 'modal', parsedClasses: modalContainerClasses });
3503
+ const modalClasses = parseClasses(['modal-content', cssClasses]);
3504
+ const modalTestId = testId !== null && testId !== void 0 ? testId : parseTestId({ tag: 'modal-content', parsedClasses: modalClasses });
3505
+ const handleCloseClick = () => {
3506
+ if (onCloseClick)
3507
+ onCloseClick();
3508
+ setModalIsOpen(false);
3509
+ };
3510
+ return (children &&
3511
+ modalIsOpen && (React.createElement("section", { "data-testid": modalContainerTestId, className: modalContainerClasses, style: containerStyle !== null && containerStyle !== void 0 ? containerStyle : undefined },
3512
+ React.createElement("section", { "data-testid": 'test-modal-background', className: 'modal-background', "aria-hidden": 'true', onClick: handleCloseClick }),
3513
+ React.createElement("section", { "data-testid": modalTestId, className: modalClasses, style: style !== null && style !== void 0 ? style : undefined }, children),
3514
+ React.createElement("button", { "data-testid": 'test-modal-close', className: 'modal-close is-large', "aria-label": 'close', onClick: handleCloseClick }))));
3515
+ };
3516
+
3517
+ export { Block, Box, BreadcrumbItem, Breadcrumbs, Button, ButtonGroup, CheckBox as Checkbox, Column, ColumnGroup, Delete, Dropdown, DropdownItem, DropdownTrigger, File, Icon, Image, Input, Menu, MenuItem, MenuList, Message, Modal, Notification, Pagination, PaginationItem, ProgressBar, RadioButton, Select, Tag, TextArea, Title };
3480
3518
  //# sourceMappingURL=index.js.map