reactive-bulma 2.17.0 → 3.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (32) hide show
  1. package/dist/cjs/index.js +139 -3
  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/Section/index.d.ts +4 -0
  8. package/dist/cjs/types/components/molecules/index.d.ts +3 -0
  9. package/dist/cjs/types/components/organisms/NavBar/index.d.ts +4 -0
  10. package/dist/cjs/types/components/organisms/index.d.ts +1 -0
  11. package/dist/cjs/types/interfaces/atomProps.d.ts +7 -1
  12. package/dist/cjs/types/interfaces/moleculeProps.d.ts +34 -3
  13. package/dist/cjs/types/interfaces/organismProps.d.ts +27 -5
  14. package/dist/cjs/types/types/domTypes.d.ts +2 -0
  15. package/dist/cjs/types/types/styleTypes.d.ts +2 -0
  16. package/dist/esm/index.js +135 -4
  17. package/dist/esm/index.js.map +1 -1
  18. package/dist/esm/types/components/atoms/NavBarItem/index.d.ts +4 -0
  19. package/dist/esm/types/components/atoms/index.d.ts +1 -0
  20. package/dist/esm/types/components/molecules/NavBarBrand/index.d.ts +4 -0
  21. package/dist/esm/types/components/molecules/NavBarDropdown/index.d.ts +4 -0
  22. package/dist/esm/types/components/molecules/Section/index.d.ts +4 -0
  23. package/dist/esm/types/components/molecules/index.d.ts +3 -0
  24. package/dist/esm/types/components/organisms/NavBar/index.d.ts +4 -0
  25. package/dist/esm/types/components/organisms/index.d.ts +1 -0
  26. package/dist/esm/types/interfaces/atomProps.d.ts +7 -1
  27. package/dist/esm/types/interfaces/moleculeProps.d.ts +34 -3
  28. package/dist/esm/types/interfaces/organismProps.d.ts +27 -5
  29. package/dist/esm/types/types/domTypes.d.ts +2 -0
  30. package/dist/esm/types/types/styleTypes.d.ts +2 -0
  31. package/dist/index.d.ts +75 -3
  32. 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);
@@ -3729,6 +3739,100 @@ const Media = ({ testId = null, cssClasses = null, style = null, leftContent = n
3729
3739
  renderMediaSection(rightContent, 'right', mediaTestId)));
3730
3740
  };
3731
3741
 
3742
+ const Section = ({ testId = null, cssClasses = null, style = null, content, size = null }) => {
3743
+ const sectionClasses = parseClasses(['section', size, cssClasses]);
3744
+ const sectionTestId = testId !== null && testId !== void 0 ? testId : parseTestId({ tag: 'section', parsedClasses: sectionClasses });
3745
+ return (React.createElement("section", { "data-testid": sectionTestId, className: sectionClasses, style: style !== null && style !== void 0 ? style : undefined }, content));
3746
+ };
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
+
3732
3836
  const renderFieldLabel = (labelText) => labelText ? (React.createElement("label", { "data-testid": 'test-form-field-label', className: 'label' }, labelText)) : null;
3733
3837
  const renderFieldBody = (inputControlConfig, isGrouped) => {
3734
3838
  if (isGrouped) {
@@ -3796,13 +3900,14 @@ const Level = ({ testId = null, cssClasses = null, style = null, leftSide = null
3796
3900
  rightSide ? (React.createElement("section", { className: 'level-right' }, renderLevelSection(rightSide))) : null));
3797
3901
  };
3798
3902
 
3903
+ const renderHeroSection = (content, type, testId, size) => type === 'body' || size === 'is-fullheight' ? (React.createElement("section", { "data-testid": `${testId}-${type}`, className: `hero-${type}` }, content)) : null;
3799
3904
  const Hero = ({ testId = null, cssClasses = null, style = null, header = null, body, footer = null, color = null, size = null }) => {
3800
3905
  const heroClasses = parseClasses(['hero', color, size, cssClasses]);
3801
3906
  const heroTestId = testId !== null && testId !== void 0 ? testId : parseTestId({ tag: 'hero', parsedClasses: heroClasses });
3802
3907
  return (React.createElement("section", { "data-testid": heroTestId, className: heroClasses, style: style !== null && style !== void 0 ? style : undefined },
3803
- size === 'is-fullheight' ? (React.createElement("section", { "data-testid": `${heroTestId}-head`, className: 'hero-head' }, header)) : null,
3804
- React.createElement("section", { "data-testid": `${heroTestId}-body`, className: 'hero-body' }, body),
3805
- size === 'is-fullheight' ? (React.createElement("section", { "data-testid": `${heroTestId}-foot`, className: 'hero-foot' }, footer)) : null));
3908
+ renderHeroSection(header, 'head', heroTestId, size),
3909
+ renderHeroSection(body, 'body', heroTestId, size),
3910
+ renderHeroSection(footer, 'foot', heroTestId, size)));
3806
3911
  };
3807
3912
 
3808
3913
  const TileGroup = ({ testId = null, cssClasses = null, style = null, context = 'is-ancestor', size = null, isVertical = false, groupConfig }) => {
@@ -3830,6 +3935,32 @@ const TileGroup = ({ testId = null, cssClasses = null, style = null, context = '
3830
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))))));
3831
3936
  };
3832
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
+
3833
3964
  exports.Block = Block;
3834
3965
  exports.Box = Box;
3835
3966
  exports.BreadcrumbItem = BreadcrumbItem;
@@ -3860,6 +3991,10 @@ exports.MenuItem = MenuItem;
3860
3991
  exports.MenuList = MenuList;
3861
3992
  exports.Message = Message;
3862
3993
  exports.Modal = Modal;
3994
+ exports.NavBar = NavBar;
3995
+ exports.NavBarBrand = NavBarBrand;
3996
+ exports.NavBarDropdown = NavBarDropdown;
3997
+ exports.NavBarItem = NavBarItem;
3863
3998
  exports.Notification = Notification;
3864
3999
  exports.Pagination = Pagination;
3865
4000
  exports.PaginationItem = PaginationItem;
@@ -3868,6 +4003,7 @@ exports.PanelBlock = PanelBlock;
3868
4003
  exports.PanelTabs = PanelTabs;
3869
4004
  exports.ProgressBar = ProgressBar;
3870
4005
  exports.RadioButton = RadioButton;
4006
+ exports.Section = Section;
3871
4007
  exports.Select = Select;
3872
4008
  exports.TabItem = TabItem;
3873
4009
  exports.Tabs = Tabs;