reactive-bulma 3.0.0 → 3.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (30) hide show
  1. package/dist/cjs/index.js +147 -0
  2. package/dist/cjs/index.js.map +1 -1
  3. package/dist/cjs/types/components/atoms/NavBarItem/index.d.ts +4 -0
  4. package/dist/cjs/types/components/atoms/index.d.ts +1 -0
  5. package/dist/cjs/types/components/molecules/NavBarBrand/index.d.ts +4 -0
  6. package/dist/cjs/types/components/molecules/NavBarDropdown/index.d.ts +4 -0
  7. package/dist/cjs/types/components/molecules/index.d.ts +2 -0
  8. package/dist/cjs/types/components/organisms/Card/index.d.ts +4 -0
  9. package/dist/cjs/types/components/organisms/NavBar/index.d.ts +4 -0
  10. package/dist/cjs/types/components/organisms/index.d.ts +2 -0
  11. package/dist/cjs/types/interfaces/atomProps.d.ts +7 -1
  12. package/dist/cjs/types/interfaces/moleculeProps.d.ts +27 -2
  13. package/dist/cjs/types/interfaces/organismProps.d.ts +39 -4
  14. package/dist/cjs/types/types/domTypes.d.ts +1 -0
  15. package/dist/esm/index.js +143 -1
  16. package/dist/esm/index.js.map +1 -1
  17. package/dist/esm/types/components/atoms/NavBarItem/index.d.ts +4 -0
  18. package/dist/esm/types/components/atoms/index.d.ts +1 -0
  19. package/dist/esm/types/components/molecules/NavBarBrand/index.d.ts +4 -0
  20. package/dist/esm/types/components/molecules/NavBarDropdown/index.d.ts +4 -0
  21. package/dist/esm/types/components/molecules/index.d.ts +2 -0
  22. package/dist/esm/types/components/organisms/Card/index.d.ts +4 -0
  23. package/dist/esm/types/components/organisms/NavBar/index.d.ts +4 -0
  24. package/dist/esm/types/components/organisms/index.d.ts +2 -0
  25. package/dist/esm/types/interfaces/atomProps.d.ts +7 -1
  26. package/dist/esm/types/interfaces/moleculeProps.d.ts +27 -2
  27. package/dist/esm/types/interfaces/organismProps.d.ts +39 -4
  28. package/dist/esm/types/types/domTypes.d.ts +1 -0
  29. package/dist/index.d.ts +78 -1
  30. package/package.json +6 -6
package/dist/cjs/index.js CHANGED
@@ -3319,6 +3319,16 @@ const Tile = ({ testId = null, cssClasses = null, style = null, children, contex
3319
3319
  return (React.createElement("section", { "data-testid": tileTestId, className: tileClasses, style: style !== null && style !== void 0 ? style : undefined }, children));
3320
3320
  };
3321
3321
 
3322
+ const NavBarItem = ({ testId = null, cssClasses = null, style = null, children, isActive = false, onClick = null }) => {
3323
+ const navBarItemClasses = parseClasses([
3324
+ 'navbar-item',
3325
+ isActive ? 'is-active' : null,
3326
+ cssClasses
3327
+ ]);
3328
+ const navBarItemTestId = testId !== null && testId !== void 0 ? testId : parseTestId({ tag: 'navbar-item', parsedClasses: navBarItemClasses });
3329
+ 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));
3330
+ };
3331
+
3322
3332
  const generateKey = (max = 5000, min = 1) => {
3323
3333
  max = Math.floor(max);
3324
3334
  min = Math.ceil(min);
@@ -3735,6 +3745,94 @@ const Section = ({ testId = null, cssClasses = null, style = null, content, size
3735
3745
  return (React.createElement("section", { "data-testid": sectionTestId, className: sectionClasses, style: style !== null && style !== void 0 ? style : undefined }, content));
3736
3746
  };
3737
3747
 
3748
+ /******************************************************************************
3749
+ Copyright (c) Microsoft Corporation.
3750
+
3751
+ Permission to use, copy, modify, and/or distribute this software for any
3752
+ purpose with or without fee is hereby granted.
3753
+
3754
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
3755
+ REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
3756
+ AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
3757
+ INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
3758
+ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
3759
+ OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
3760
+ PERFORMANCE OF THIS SOFTWARE.
3761
+ ***************************************************************************** */
3762
+ /* global Reflect, Promise, SuppressedError, Symbol */
3763
+
3764
+
3765
+ function __rest(s, e) {
3766
+ var t = {};
3767
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
3768
+ t[p] = s[p];
3769
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
3770
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
3771
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
3772
+ t[p[i]] = s[p[i]];
3773
+ }
3774
+ return t;
3775
+ }
3776
+
3777
+ typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
3778
+ var e = new Error(message);
3779
+ return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
3780
+ };
3781
+
3782
+ const NavBarBrand = ({ testId = null, cssClasses = null, style = null, brandConfig, isBurgerActive = false }) => {
3783
+ const navBarBrandClasses = parseClasses(['navbar-brand', cssClasses]);
3784
+ const navBarBrandTestId = testId !== null && testId !== void 0 ? testId : parseTestId({ tag: 'navbar-brand', parsedClasses: navBarBrandClasses });
3785
+ const navBarBurgerClasses = parseClasses([
3786
+ 'navbar-burger',
3787
+ isBurgerActive ? 'is-active' : null
3788
+ ]);
3789
+ const navBarBurgerTestId = parseTestId({
3790
+ tag: 'navbar-burger',
3791
+ parsedClasses: navBarBurgerClasses
3792
+ });
3793
+ const { children } = brandConfig, brandItemConfig = __rest(brandConfig, ["children"]);
3794
+ return (React.createElement("section", { "data-testid": navBarBrandTestId, className: navBarBrandClasses, style: style !== null && style !== void 0 ? style : undefined },
3795
+ React.createElement(NavBarItem, Object.assign({}, brandItemConfig),
3796
+ React.createElement(Image, Object.assign({}, children))),
3797
+ React.createElement("a", { role: 'button', "data-testid": navBarBurgerTestId, className: navBarBurgerClasses, "aria-label": 'menu', "aria-expanded": 'false' },
3798
+ React.createElement("span", { "aria-hidden": 'true' }),
3799
+ React.createElement("span", { "aria-hidden": 'true' }),
3800
+ React.createElement("span", { "aria-hidden": 'true' }))));
3801
+ };
3802
+
3803
+ const renderDropdownItem = (dropdownItemConfig) => dropdownItemConfig === 'divider' ? (React.createElement("hr", { key: `navbar-dropdown-divider-${generateKey()}`, className: 'navbar-divider' })) : (React.createElement(NavBarItem, Object.assign({ key: `navbar-dropdown-item-${generateKey()}` }, dropdownItemConfig)));
3804
+ const NavBarDropdown = ({ testId = null, containerTestId = null, cssClasses = null, containerCssClasses = null, style = null, containerStyle = null, text, items, position = null, isActive = false, isHoverable = false, hasDropdownUp = false, hasBoxedMenu = false }) => {
3805
+ const navBarDropdownContainerClasses = parseClasses([
3806
+ 'navbar-item',
3807
+ 'has-dropdown',
3808
+ position,
3809
+ isActive ? 'is-active' : null,
3810
+ isHoverable ? 'is-hoverable' : null,
3811
+ hasDropdownUp ? 'has-dropdown-up' : null,
3812
+ containerCssClasses
3813
+ ]);
3814
+ const navBarDropdownContainerTestId = containerTestId !== null && containerTestId !== void 0 ? containerTestId : parseTestId({
3815
+ tag: 'navbar-dropdown-container',
3816
+ parsedClasses: navBarDropdownContainerClasses,
3817
+ rules: [
3818
+ { regExp: /navbar-item|has-dropdown/gm, replacer: '' },
3819
+ { regExp: /is-|has-/gm, replacer: '-' }
3820
+ ]
3821
+ });
3822
+ const navBarDropdownClasses = parseClasses([
3823
+ 'navbar-dropdown',
3824
+ hasBoxedMenu ? 'is-boxed' : null,
3825
+ cssClasses
3826
+ ]);
3827
+ const navBarDropdownTestId = testId !== null && testId !== void 0 ? testId : parseTestId({
3828
+ tag: 'navbar-dropdown',
3829
+ parsedClasses: navBarDropdownClasses
3830
+ });
3831
+ return (React.createElement("section", { "data-testid": navBarDropdownContainerTestId, className: navBarDropdownContainerClasses, style: containerStyle !== null && containerStyle !== void 0 ? containerStyle : undefined },
3832
+ React.createElement("a", { className: 'navbar-link', "aria-hidden": 'true' }, text),
3833
+ React.createElement("section", { "data-testid": navBarDropdownTestId, className: navBarDropdownClasses, style: style !== null && style !== void 0 ? style : undefined }, items.map(renderDropdownItem))));
3834
+ };
3835
+
3738
3836
  const renderFieldLabel = (labelText) => labelText ? (React.createElement("label", { "data-testid": 'test-form-field-label', className: 'label' }, labelText)) : null;
3739
3837
  const renderFieldBody = (inputControlConfig, isGrouped) => {
3740
3838
  if (isGrouped) {
@@ -3837,12 +3935,57 @@ const TileGroup = ({ testId = null, cssClasses = null, style = null, context = '
3837
3935
  return (React.createElement(Tile, { testId: tileBoxTestId, cssClasses: cssClasses !== null && cssClasses !== void 0 ? cssClasses : undefined, style: style !== null && style !== void 0 ? style : undefined, context: context, size: size !== null && size !== void 0 ? size : undefined, isVertical: isVertical }, groupConfig.map(tileConfig => (React.createElement(Tile, Object.assign({ key: `tile-item-${generateKey()}` }, tileConfig))))));
3838
3936
  };
3839
3937
 
3938
+ const renderNavBarMenuSection = (menuSectionConfig, menuSection, testId) => menuSectionConfig ? (React.createElement("section", { "data-testid": `${testId}-${menuSection}`, className: `navbar-${menuSection}` }, menuSectionConfig.itemList.map(itemConfig => itemConfig.children !== undefined ? (React.createElement(NavBarItem, Object.assign({ key: `navbar-section${menuSection}-${generateKey()}` }, itemConfig))) : (React.createElement(NavBarDropdown, Object.assign({ key: `navbar-section${menuSection}-${generateKey()}` }, itemConfig)))))) : null;
3939
+ const NavBar = ({ testId = null, cssClasses = null, style = null, brandConfig = null, itemsAtStart = null, itemsAtEnd = null, fixedPosition = null, color = null, isTransparent = false, isSpaced = false, hasShadow = false }) => {
3940
+ const navBarClasses = parseClasses([
3941
+ 'navbar',
3942
+ fixedPosition,
3943
+ color,
3944
+ isTransparent ? 'is-transparent' : null,
3945
+ isSpaced ? 'is-spaced' : null,
3946
+ hasShadow ? 'has-shadow' : null,
3947
+ cssClasses
3948
+ ]);
3949
+ const navBarTestId = testId !== null && testId !== void 0 ? testId : parseTestId({
3950
+ tag: 'navbar',
3951
+ parsedClasses: navBarClasses,
3952
+ rules: [
3953
+ { regExp: /is-|has-/gm, replacer: '-' },
3954
+ { regExp: /navbar/gm, replacer: '' }
3955
+ ]
3956
+ });
3957
+ return (React.createElement("nav", { "data-testid": navBarTestId, className: navBarClasses, style: style !== null && style !== void 0 ? style : undefined },
3958
+ brandConfig ? (React.createElement("section", { "data-testid": 'navbar-brand', className: 'navbar-brand' }, React.createElement(NavBarBrand, Object.assign({}, brandConfig)))) : null,
3959
+ React.createElement("section", { className: 'navbar-menu' },
3960
+ renderNavBarMenuSection(itemsAtStart, 'start', navBarTestId),
3961
+ renderNavBarMenuSection(itemsAtEnd, 'end', navBarTestId))));
3962
+ };
3963
+
3964
+ const Card = ({ testId = null, cssClasses = null, style = null, headerText = null, image = null, content, footerLinks = null }) => {
3965
+ const cardClasses = parseClasses(['card', cssClasses]);
3966
+ const cardTestId = testId !== null && testId !== void 0 ? testId : parseTestId({ tag: 'card', parsedClasses: cardClasses });
3967
+ return (React.createElement("section", { "data-testid": cardTestId, className: cardClasses, style: style !== null && style !== void 0 ? style : undefined },
3968
+ headerText ? (React.createElement("header", { "data-testid": `${cardTestId}-header`, className: 'card-header' },
3969
+ React.createElement("p", { className: 'card-header-title' }, headerText),
3970
+ React.createElement("button", { className: 'card-header-icon', "aria-label": 'more options' },
3971
+ React.createElement("span", { className: 'icon' },
3972
+ React.createElement("i", { className: 'fas fa-angle-down', "aria-hidden": 'true' }))))) : null,
3973
+ image ? (React.createElement("section", { "data-testid": `${cardTestId}-image`, className: 'card-image' },
3974
+ React.createElement(Image, Object.assign({}, image)))) : null,
3975
+ React.createElement("section", { "data-testid": `${cardTestId}-content`, className: 'card-content' }, Array.isArray(content) ? (content.map((_contentConfig, i) => (React.createElement("section", { key: `card-content-item-${generateKey()}`, "data-testid": `${cardTestId}-content-item-${i}`, className: 'content' }, _contentConfig)))) : (React.createElement("section", { className: 'content' }, content))),
3976
+ footerLinks ? (React.createElement("section", { className: 'card-footer' }, footerLinks.map((_footerConfig, i) => {
3977
+ var _a;
3978
+ return (React.createElement("a", { key: `card-footer-item-${generateKey()}`, "data-testid": `${cardTestId}-footer-item-${i}`, className: 'card-footer-item', "aria-hidden": 'true', onClick: (_a = _footerConfig.onClick) !== null && _a !== void 0 ? _a : undefined }, _footerConfig.text));
3979
+ }))) : null));
3980
+ };
3981
+
3840
3982
  exports.Block = Block;
3841
3983
  exports.Box = Box;
3842
3984
  exports.BreadcrumbItem = BreadcrumbItem;
3843
3985
  exports.Breadcrumbs = Breadcrumbs;
3844
3986
  exports.Button = Button;
3845
3987
  exports.ButtonGroup = ButtonGroup;
3988
+ exports.Card = Card;
3846
3989
  exports.Checkbox = CheckBox;
3847
3990
  exports.Column = Column;
3848
3991
  exports.ColumnGroup = ColumnGroup;
@@ -3867,6 +4010,10 @@ exports.MenuItem = MenuItem;
3867
4010
  exports.MenuList = MenuList;
3868
4011
  exports.Message = Message;
3869
4012
  exports.Modal = Modal;
4013
+ exports.NavBar = NavBar;
4014
+ exports.NavBarBrand = NavBarBrand;
4015
+ exports.NavBarDropdown = NavBarDropdown;
4016
+ exports.NavBarItem = NavBarItem;
3870
4017
  exports.Notification = Notification;
3871
4018
  exports.Pagination = Pagination;
3872
4019
  exports.PaginationItem = PaginationItem;