reactive-bulma 3.2.0 → 4.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (29) hide show
  1. package/README.md +37 -28
  2. package/dist/cjs/index.js +45 -0
  3. package/dist/cjs/index.js.map +1 -1
  4. package/dist/cjs/types/components/atoms/TableCell/index.d.ts +4 -0
  5. package/dist/cjs/types/components/atoms/TableHeadCell/index.d.ts +4 -0
  6. package/dist/cjs/types/components/atoms/index.d.ts +2 -0
  7. package/dist/cjs/types/components/molecules/TableRow/index.d.ts +4 -0
  8. package/dist/cjs/types/components/molecules/index.d.ts +1 -0
  9. package/dist/cjs/types/components/organisms/Table/index.d.ts +4 -0
  10. package/dist/cjs/types/components/organisms/index.d.ts +1 -0
  11. package/dist/cjs/types/functions/jest.d.ts +2 -0
  12. package/dist/cjs/types/interfaces/atomProps.d.ts +8 -0
  13. package/dist/cjs/types/interfaces/moleculeProps.d.ts +10 -2
  14. package/dist/cjs/types/interfaces/organismProps.d.ts +22 -2
  15. package/dist/esm/index.js +42 -1
  16. package/dist/esm/index.js.map +1 -1
  17. package/dist/esm/types/components/atoms/TableCell/index.d.ts +4 -0
  18. package/dist/esm/types/components/atoms/TableHeadCell/index.d.ts +4 -0
  19. package/dist/esm/types/components/atoms/index.d.ts +2 -0
  20. package/dist/esm/types/components/molecules/TableRow/index.d.ts +4 -0
  21. package/dist/esm/types/components/molecules/index.d.ts +1 -0
  22. package/dist/esm/types/components/organisms/Table/index.d.ts +4 -0
  23. package/dist/esm/types/components/organisms/index.d.ts +1 -0
  24. package/dist/esm/types/functions/jest.d.ts +2 -0
  25. package/dist/esm/types/interfaces/atomProps.d.ts +8 -0
  26. package/dist/esm/types/interfaces/moleculeProps.d.ts +10 -2
  27. package/dist/esm/types/interfaces/organismProps.d.ts +22 -2
  28. package/dist/index.d.ts +46 -2
  29. package/package.json +12 -12
@@ -0,0 +1,4 @@
1
+ import React from 'react';
2
+ import { TableCellProps } from '../../../interfaces/atomProps';
3
+ declare const TableCell: React.FC<TableCellProps>;
4
+ export default TableCell;
@@ -0,0 +1,4 @@
1
+ import React from 'react';
2
+ import { TableHeadCellProps } from '../../../interfaces/atomProps';
3
+ declare const TableHeadCell: React.FC<TableHeadCellProps>;
4
+ export default TableHeadCell;
@@ -23,3 +23,5 @@ export { default as TabItem } from './TabItem';
23
23
  export { default as LevelHeader } from './LevelHeader';
24
24
  export { default as Tile } from './Tile';
25
25
  export { default as NavBarItem } from './NavBarItem';
26
+ export { default as TableHeadCell } from './TableHeadCell';
27
+ export { default as TableCell } from './TableCell';
@@ -0,0 +1,4 @@
1
+ import React from 'react';
2
+ import { TableRowProps } from '../../../interfaces/moleculeProps';
3
+ declare const TableRow: React.FC<TableRowProps>;
4
+ export default TableRow;
@@ -19,3 +19,4 @@ export { default as Media } from './Media';
19
19
  export { default as Section } from './Section';
20
20
  export { default as NavBarBrand } from './NavBarBrand';
21
21
  export { default as NavBarDropdown } from './NavBarDropdown';
22
+ export { default as TableRow } from './TableRow';
@@ -0,0 +1,4 @@
1
+ import React from 'react';
2
+ import { TableProps } from '../../../interfaces/organismProps';
3
+ declare const Table: React.FC<TableProps>;
4
+ export default Table;
@@ -5,3 +5,4 @@ export { default as Hero } from './Hero';
5
5
  export { default as TileGroup } from './TileGroup';
6
6
  export { default as NavBar } from './NavBar';
7
7
  export { default as Card } from './Card';
8
+ export { default as Table } from './Table';
@@ -0,0 +1,2 @@
1
+ import React from 'react';
2
+ export declare const renderTestingTableContainer: (element: React.ReactElement) => import("@testing-library/react").RenderResult<typeof import("@testing-library/dom/types/queries"), HTMLElement, HTMLElement>;
@@ -295,3 +295,11 @@ export interface NavBarItemProps extends ElementProps, ClickeableProps {
295
295
  /** `Styling` Used for `NavBarDropdown` styling purpose only. Will mark the item as the one selected among its group */
296
296
  isActive?: boolean;
297
297
  }
298
+ export interface TableHeadCellProps extends ElementProps, ClickeableProps {
299
+ /** `Attribute` `Required` It will display cell's content, which could be text, an html tag or a custom component */
300
+ content: SingleChildType;
301
+ }
302
+ export interface TableCellProps extends ElementProps, ClickeableProps {
303
+ /** `Attribute` `Required` It will display cell's content, which could be text, an html tag or a custom component */
304
+ content: SingleChildType;
305
+ }
@@ -1,5 +1,5 @@
1
1
  import { ClickeableProps, ComposedElementProps, ElementProps } from './commonProps';
2
- import { BreadcrumbItemProps, ButtonProps, ColumnProps, DeleteProps, DropdownItemProps, IconProps, ImageProps, InputProps, MenuItemProps, NavBarItemProps, PaginationItemProps, TabItemProps, TileProps } from './atomProps';
2
+ import { BreadcrumbItemProps, ButtonProps, ColumnProps, DeleteProps, DropdownItemProps, IconProps, ImageProps, InputProps, MenuItemProps, NavBarItemProps, PaginationItemProps, TabItemProps, TableCellProps, TableHeadCellProps, TileProps } from './atomProps';
3
3
  import { BasicColorType, RightCenteredAlignType, BreadcrumbSeparatorType, ColumnGapType, SizeWithoutNormalType, TabsFormatType, MediumAndLargeSizeType, RightLeftAlignType } from '../types/styleTypes';
4
4
  import { ChildrenType, SingleChildType, PanelBlockItemType } from '../types/domTypes';
5
5
  export interface ButtonGroupProps extends ElementProps {
@@ -215,9 +215,17 @@ interface BrandConfigProps extends Omit<NavBarItemProps, 'children'> {
215
215
  children: ImageProps;
216
216
  }
217
217
  export interface NavBarBrandProps extends ElementProps {
218
- /** `Attribute` `Required` Configuration object to inject a NavBarItem with a Image configuration as its children */
218
+ /** `Attribute` `Required` Configuration object to inject a `NavBarItem` with a Image configuration as its children */
219
219
  brandConfig: BrandConfigProps;
220
220
  /** `Styling` It sets brand's burger button as active (changing looks from a burger to a cross) */
221
221
  isBurgerActive?: boolean;
222
222
  }
223
+ export interface TableRowProps extends ElementProps, ClickeableProps {
224
+ /** `Attribute` Configuration object to inject a `TableHeaderCell` as row's head */
225
+ headCell?: TableHeadCellProps;
226
+ /** `Attribute` `Required` List of `TableCell` that will be rendered on the table */
227
+ listOfCells: TableCellProps[];
228
+ /** `Styling` Used for `Table` styling purpose only. Will set row's background color to indicate it has been selected by the user */
229
+ isSelected?: boolean;
230
+ }
223
231
  export {};
@@ -1,6 +1,6 @@
1
1
  import { ClickeableProps, ElementProps } from './commonProps';
2
- import { InputControlProps, LevelItemProps, NavBarBrandProps, NavBarDropdownProps, PanelBlockProps, PanelTabsProps } from './moleculeProps';
3
- import { ImageProps, NavBarItemProps, TileProps } from './atomProps';
2
+ import { InputControlProps, LevelItemProps, NavBarBrandProps, NavBarDropdownProps, PanelBlockProps, PanelTabsProps, TableRowProps } from './moleculeProps';
3
+ import { ImageProps, NavBarItemProps, TableHeadCellProps, TileProps } from './atomProps';
4
4
  import { BasicColorType, SizeWithHeightType } from '../types/styleTypes';
5
5
  import { ChildrenType, NavBarFixedPositionType } from '../types/domTypes';
6
6
  export interface FormFieldHelperProps {
@@ -90,3 +90,23 @@ export interface CardProps extends ElementProps {
90
90
  /** `Attribute` A list of footer links that will be rendered on card's bottom, below its content */
91
91
  footerLinks?: CardFooterProps[];
92
92
  }
93
+ export interface TableProps extends ElementProps {
94
+ /** `Attribute` `Required` Configuration object that will display table's head */
95
+ head: TableHeadCellProps[];
96
+ /** `Attribute` `Required` Configuration object that will display table's body */
97
+ body: TableRowProps[];
98
+ /** `Attribute` Configuration object that will display table's foot */
99
+ foot?: TableHeadCellProps[];
100
+ /** `Styling` It will add a Bordered styling to the table. It can be combined with other mentioned styling properties. */
101
+ isBordered?: boolean;
102
+ /** `Styling` It will add a Striped styling to the table. It can be combined with other mentioned styling properties. */
103
+ isStriped?: boolean;
104
+ /** `Styling` It will add a Narrow styling to the table. It can be combined with other mentioned styling properties. */
105
+ isNarrow?: boolean;
106
+ /** `Styling` It will add a Hoverable styling to the table. It can be combined with other mentioned styling properties. */
107
+ isHoverable?: boolean;
108
+ /** `Styling` It will add a Fullwidth styling to the table. It can be combined with other mentioned styling properties. */
109
+ isFullwidth?: boolean;
110
+ /** `Styling` Will create a container around the table in order to make it scrollable */
111
+ isContained?: boolean;
112
+ }
package/dist/esm/index.js CHANGED
@@ -3327,6 +3327,16 @@ const NavBarItem = ({ testId = null, cssClasses = null, style = null, children,
3327
3327
  return (React.createElement("a", { "data-testid": navBarItemTestId, className: navBarItemClasses, style: style !== null && style !== void 0 ? style : undefined, "aria-hidden": 'true', onClick: onClick !== null && onClick !== void 0 ? onClick : undefined }, children));
3328
3328
  };
3329
3329
 
3330
+ const TableHeadCell = ({ testId = null, cssClasses = null, style = null, content, onClick = null }) => {
3331
+ const tableHeadCellTestId = testId !== null && testId !== void 0 ? testId : parseTestId({ tag: 'table-head-cell', parsedClasses: cssClasses !== null && cssClasses !== void 0 ? cssClasses : '' });
3332
+ return (React.createElement("th", { "data-testid": tableHeadCellTestId, className: cssClasses !== null && cssClasses !== void 0 ? cssClasses : undefined, style: style !== null && style !== void 0 ? style : undefined, onClick: onClick !== null && onClick !== void 0 ? onClick : undefined }, content));
3333
+ };
3334
+
3335
+ const TableCell = ({ testId = null, cssClasses = null, style = null, content, onClick = null }) => {
3336
+ const tableCellTestId = testId !== null && testId !== void 0 ? testId : parseTestId({ tag: 'table-cell', parsedClasses: cssClasses !== null && cssClasses !== void 0 ? cssClasses : '' });
3337
+ return (React.createElement("td", { "data-testid": tableCellTestId, className: cssClasses !== null && cssClasses !== void 0 ? cssClasses : undefined, style: style !== null && style !== void 0 ? style : undefined, onClick: onClick !== null && onClick !== void 0 ? onClick : undefined }, content));
3338
+ };
3339
+
3330
3340
  const generateKey = (max = 5000, min = 1) => {
3331
3341
  max = Math.floor(max);
3332
3342
  min = Math.ceil(min);
@@ -3831,6 +3841,17 @@ const NavBarDropdown = ({ testId = null, containerTestId = null, cssClasses = nu
3831
3841
  React.createElement("section", { "data-testid": navBarDropdownTestId, className: navBarDropdownClasses, style: style !== null && style !== void 0 ? style : undefined }, items.map(renderDropdownItem))));
3832
3842
  };
3833
3843
 
3844
+ const TableRow = ({ testId = null, cssClasses = null, style = null, headCell = null, listOfCells, isSelected = false, onClick = null }) => {
3845
+ const tableRowClasses = parseClasses([
3846
+ isSelected ? 'is-selected' : null,
3847
+ cssClasses
3848
+ ]);
3849
+ const tableRowTestId = testId !== null && testId !== void 0 ? testId : parseTestId({ tag: 'table-row', parsedClasses: tableRowClasses });
3850
+ return (React.createElement("tr", { "data-testid": tableRowTestId, className: tableRowClasses, style: style !== null && style !== void 0 ? style : undefined, onClick: onClick !== null && onClick !== void 0 ? onClick : undefined },
3851
+ headCell ? React.createElement(TableHeadCell, Object.assign({}, headCell)) : null,
3852
+ listOfCells.map(_cellConfig => (React.createElement(TableCell, Object.assign({ key: `table-row-${generateKey()}` }, _cellConfig))))));
3853
+ };
3854
+
3834
3855
  const renderFieldLabel = (labelText) => labelText ? (React.createElement("label", { "data-testid": 'test-form-field-label', className: 'label' }, labelText)) : null;
3835
3856
  const renderFieldBody = (inputControlConfig, isGrouped) => {
3836
3857
  if (isGrouped) {
@@ -3977,5 +3998,25 @@ const Card = ({ testId = null, cssClasses = null, style = null, headerText = nul
3977
3998
  }))) : null));
3978
3999
  };
3979
4000
 
3980
- export { Block, Box, BreadcrumbItem, Breadcrumbs, Button, ButtonGroup, Card, CheckBox as Checkbox, Column, ColumnGroup, Delete, Dropdown, DropdownItem, DropdownTrigger, File, Footer, FormField, Hero, Icon, Image, Input, InputControl, Level, LevelHeader, LevelItem, Media, Menu, MenuItem, MenuList, Message, Modal, NavBar, NavBarBrand, NavBarDropdown, NavBarItem, Notification, Pagination, PaginationItem, Panel, PanelBlock, PanelTabs, ProgressBar, RadioButton, Section, Select, TabItem, Tabs, Tag, TextArea, Tile, TileBox, TileGroup, Title };
4001
+ /* eslint-disable react/prop-types */
4002
+ const renderTableSection = (sectionName, configData) => (React.createElement("tr", null, configData.map(_ItemConfig => (React.createElement(TableHeadCell, Object.assign({ key: `table-${sectionName}-item-${generateKey()}` }, _ItemConfig))))));
4003
+ const Table = ({ testId = null, cssClasses = null, style = null, head, body, foot = null, isBordered = false, isStriped = false, isNarrow = false, isHoverable = false, isFullwidth = false, isContained = false }) => {
4004
+ const tableClasses = parseClasses([
4005
+ 'table',
4006
+ isBordered ? 'is-bordered' : null,
4007
+ isStriped ? 'is-striped' : null,
4008
+ isNarrow ? 'is-narrow' : null,
4009
+ isHoverable ? 'is-hoverable' : null,
4010
+ isFullwidth ? 'is-fullwidth' : null,
4011
+ cssClasses
4012
+ ]);
4013
+ const tableTestId = testId !== null && testId !== void 0 ? testId : parseTestId({ tag: 'table', parsedClasses: tableClasses });
4014
+ const TableElement = () => (React.createElement("table", { "data-testid": tableTestId, className: tableClasses, style: style !== null && style !== void 0 ? style : undefined },
4015
+ React.createElement("thead", { "data-testid": `${tableTestId}-head` }, renderTableSection('head', head)),
4016
+ React.createElement("tbody", { "data-testid": `${tableTestId}-body` }, body.map(_bodyRowConfig => (React.createElement(TableRow, Object.assign({ key: `table-body-item-${generateKey()}` }, _bodyRowConfig))))),
4017
+ foot ? (React.createElement("tfoot", { "data-testid": `${tableTestId}-foot` }, renderTableSection('foot', foot))) : null));
4018
+ return isContained ? (React.createElement("section", { "data-testid": `${tableTestId}-container`, className: 'table-container' }, React.createElement(TableElement, null))) : (React.createElement(TableElement, null));
4019
+ };
4020
+
4021
+ export { Block, Box, BreadcrumbItem, Breadcrumbs, Button, ButtonGroup, Card, CheckBox as Checkbox, Column, ColumnGroup, Delete, Dropdown, DropdownItem, DropdownTrigger, File, Footer, FormField, Hero, Icon, Image, Input, InputControl, Level, LevelHeader, LevelItem, Media, Menu, MenuItem, MenuList, Message, Modal, NavBar, NavBarBrand, NavBarDropdown, NavBarItem, Notification, Pagination, PaginationItem, Panel, PanelBlock, PanelTabs, ProgressBar, RadioButton, Section, Select, TabItem, Table, TableCell, TableHeadCell, TableRow, Tabs, Tag, TextArea, Tile, TileBox, TileGroup, Title };
3981
4022
  //# sourceMappingURL=index.js.map