reactive-bulma 3.0.0 → 3.1.0
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/cjs/index.js +128 -0
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/types/components/atoms/NavBarItem/index.d.ts +4 -0
- package/dist/cjs/types/components/atoms/index.d.ts +1 -0
- package/dist/cjs/types/components/molecules/NavBarBrand/index.d.ts +4 -0
- package/dist/cjs/types/components/molecules/NavBarDropdown/index.d.ts +4 -0
- package/dist/cjs/types/components/molecules/index.d.ts +2 -0
- package/dist/cjs/types/components/organisms/NavBar/index.d.ts +4 -0
- package/dist/cjs/types/components/organisms/index.d.ts +1 -0
- package/dist/cjs/types/interfaces/atomProps.d.ts +7 -1
- package/dist/cjs/types/interfaces/moleculeProps.d.ts +27 -2
- package/dist/cjs/types/interfaces/organismProps.d.ts +25 -3
- package/dist/cjs/types/types/domTypes.d.ts +1 -0
- package/dist/esm/index.js +125 -1
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/types/components/atoms/NavBarItem/index.d.ts +4 -0
- package/dist/esm/types/components/atoms/index.d.ts +1 -0
- package/dist/esm/types/components/molecules/NavBarBrand/index.d.ts +4 -0
- package/dist/esm/types/components/molecules/NavBarDropdown/index.d.ts +4 -0
- package/dist/esm/types/components/molecules/index.d.ts +2 -0
- package/dist/esm/types/components/organisms/NavBar/index.d.ts +4 -0
- package/dist/esm/types/components/organisms/index.d.ts +1 -0
- package/dist/esm/types/interfaces/atomProps.d.ts +7 -1
- package/dist/esm/types/interfaces/moleculeProps.d.ts +27 -2
- package/dist/esm/types/interfaces/organismProps.d.ts +25 -3
- package/dist/esm/types/types/domTypes.d.ts +1 -0
- package/dist/index.d.ts +63 -1
- package/package.json +1 -1
@@ -22,3 +22,4 @@ export { default as PaginationItem } from './PaginationItem';
|
|
22
22
|
export { default as TabItem } from './TabItem';
|
23
23
|
export { default as LevelHeader } from './LevelHeader';
|
24
24
|
export { default as Tile } from './Tile';
|
25
|
+
export { default as NavBarItem } from './NavBarItem';
|
@@ -17,3 +17,5 @@ export { default as TileBox } from './TileBox';
|
|
17
17
|
export { default as Footer } from './Footer';
|
18
18
|
export { default as Media } from './Media';
|
19
19
|
export { default as Section } from './Section';
|
20
|
+
export { default as NavBarBrand } from './NavBarBrand';
|
21
|
+
export { default as NavBarDropdown } from './NavBarDropdown';
|
@@ -1,7 +1,7 @@
|
|
1
1
|
import React from 'react';
|
2
2
|
import { ElementProps, ComposedElementProps, ClickeableProps } from './commonProps';
|
3
3
|
import { BasicColorType, ColumnOffsetType, ColumnSizeType, FixedImageSizeType, IconColorModeType, ElementSizeType, SizeWithoutNormalType, TextColorType, TitleSizeType, RightLeftAlignType, CommonSizeType } from '../types/styleTypes';
|
4
|
-
import { DropdownItemType, InputType, ChildrenType, TileContextType } from '../types/domTypes';
|
4
|
+
import { DropdownItemType, InputType, ChildrenType, TileContextType, SingleChildType } from '../types/domTypes';
|
5
5
|
export interface ColumnProps extends ElementProps, React.ComponentPropsWithoutRef<'section'> {
|
6
6
|
/** `Attribute` Reffers to the component or array of components that will be shown inside the column */
|
7
7
|
children?: ChildrenType;
|
@@ -289,3 +289,9 @@ export interface TileProps extends ElementProps {
|
|
289
289
|
/** `Styling` Used for hierarchy level as ancestor or parent. It selects its children in a vertical format (like a column) */
|
290
290
|
isVertical?: boolean;
|
291
291
|
}
|
292
|
+
export interface NavBarItemProps extends ElementProps, ClickeableProps {
|
293
|
+
/** `Attribute` `Required` Reffers to the component or string that will be shown inside the item */
|
294
|
+
children: SingleChildType;
|
295
|
+
/** `Styling` Used for `NavBarDropdown` styling purpose only. Will mark the item as the one selected among its group */
|
296
|
+
isActive?: boolean;
|
297
|
+
}
|
@@ -1,6 +1,6 @@
|
|
1
1
|
import { ClickeableProps, ComposedElementProps, ElementProps } from './commonProps';
|
2
|
-
import { BreadcrumbItemProps, ButtonProps, ColumnProps, DeleteProps, DropdownItemProps, IconProps, InputProps, MenuItemProps, PaginationItemProps, TabItemProps, TileProps } from './atomProps';
|
3
|
-
import { BasicColorType, RightCenteredAlignType, BreadcrumbSeparatorType, ColumnGapType, SizeWithoutNormalType, TabsFormatType, MediumAndLargeSizeType } from '../types/styleTypes';
|
2
|
+
import { BreadcrumbItemProps, ButtonProps, ColumnProps, DeleteProps, DropdownItemProps, IconProps, ImageProps, InputProps, MenuItemProps, NavBarItemProps, PaginationItemProps, TabItemProps, TileProps } from './atomProps';
|
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 {
|
6
6
|
/** `Atribute` `Required` Array of `Button` objects that will be shown */
|
@@ -195,4 +195,29 @@ export interface SectionProps extends ElementProps {
|
|
195
195
|
/** `Styling` Set button's size on bulma's size tokens */
|
196
196
|
size?: MediumAndLargeSizeType;
|
197
197
|
}
|
198
|
+
export interface NavBarDropdownProps extends ComposedElementProps {
|
199
|
+
/** `Attribute` `Required` It will show the presentation text to be clicked or hovered in order to display its menu */
|
200
|
+
text: string;
|
201
|
+
/** `Attribute` `Required` A list of configuration objects that will render in dropdown's menu. Those can be items or dividers */
|
202
|
+
items: Array<NavBarItemProps | 'divider'>;
|
203
|
+
/** `Styling` Used for `NavBar` styling purpose only. Will set the dropdown on a specific position based on the proveded value */
|
204
|
+
position?: RightLeftAlignType;
|
205
|
+
/** `Styling` Used to display dropdown's menu when user clicks on its text */
|
206
|
+
isActive?: boolean;
|
207
|
+
/** `Styling` Similar to `isActive`, but will display when user hovers its pointer on its text */
|
208
|
+
isHoverable?: boolean;
|
209
|
+
/** `Styling` Sets dropdown's menu on top of the text instead default styling */
|
210
|
+
hasDropdownUp?: boolean;
|
211
|
+
/** `Styling` Sets dropdown's menu design like a box, also adds some animation when its diplayed */
|
212
|
+
hasBoxedMenu?: boolean;
|
213
|
+
}
|
214
|
+
interface BrandConfigProps extends Omit<NavBarItemProps, 'children'> {
|
215
|
+
children: ImageProps;
|
216
|
+
}
|
217
|
+
export interface NavBarBrandProps extends ElementProps {
|
218
|
+
/** `Attribute` `Required` Configuration object to inject a NavBarItem with a Image configuration as its children */
|
219
|
+
brandConfig: BrandConfigProps;
|
220
|
+
/** `Styling` It sets brand's burger button as active (changing looks from a burger to a cross) */
|
221
|
+
isBurgerActive?: boolean;
|
222
|
+
}
|
198
223
|
export {};
|
@@ -1,8 +1,8 @@
|
|
1
1
|
import { ElementProps } from './commonProps';
|
2
|
-
import { InputControlProps, LevelItemProps, PanelBlockProps, PanelTabsProps } from './moleculeProps';
|
2
|
+
import { InputControlProps, LevelItemProps, NavBarBrandProps, NavBarDropdownProps, PanelBlockProps, PanelTabsProps } from './moleculeProps';
|
3
3
|
import { BasicColorType, SizeWithHeightType } from '../types/styleTypes';
|
4
|
-
import { ChildrenType } from '../types/domTypes';
|
5
|
-
import { TileProps } from './atomProps';
|
4
|
+
import { ChildrenType, NavBarFixedPositionType } from '../types/domTypes';
|
5
|
+
import { NavBarItemProps, TileProps } from './atomProps';
|
6
6
|
export interface FormFieldHelperProps {
|
7
7
|
text?: string;
|
8
8
|
color?: BasicColorType;
|
@@ -55,3 +55,25 @@ export interface TileGroupProps extends ElementProps, Pick<TileProps, 'context'
|
|
55
55
|
/** `Attribute` `Required` A list of `Title` configurations that will be displayed in a grid mode on the screen */
|
56
56
|
groupConfig: TileProps[];
|
57
57
|
}
|
58
|
+
export interface NavBarMenuProps {
|
59
|
+
itemList: Array<NavBarItemProps | NavBarDropdownProps>;
|
60
|
+
showInMobile?: boolean;
|
61
|
+
}
|
62
|
+
export interface NavBarProps extends ElementProps {
|
63
|
+
/** `Attribute` Configuration object for navbar's left section, it needs of a `NavBarBrand` object to be displayed at NavBar's start */
|
64
|
+
brandConfig?: NavBarBrandProps;
|
65
|
+
/** `Attribute` Configuration object for navbar's left section, it needs of a list of `NavBarItem` or `NavBarDropdown` objects to be displayed */
|
66
|
+
itemsAtStart?: NavBarMenuProps;
|
67
|
+
/** `Attribute` Configuration object for navbar's right section, it needs of a list of `NavBarItem` or `NavBarDropdown` objects to be displayed */
|
68
|
+
itemsAtEnd?: NavBarMenuProps;
|
69
|
+
/** `Styling` Sets navbar's position at screen's top or bottom */
|
70
|
+
fixedPosition?: NavBarFixedPositionType;
|
71
|
+
/** `Styling` Color based on bulma's text color tokens */
|
72
|
+
color?: BasicColorType;
|
73
|
+
/** `Styling` Sets navbar's color as transparent */
|
74
|
+
isTransparent?: boolean;
|
75
|
+
/** `Styling` Adds a small padding around the navbar */
|
76
|
+
isSpaced?: boolean;
|
77
|
+
/** `Styling` Adds a small shadow on navbar's bottom */
|
78
|
+
hasShadow?: boolean;
|
79
|
+
}
|
@@ -13,3 +13,4 @@ export declare enum IconSizeEnum {
|
|
13
13
|
export type TileContextType = 'is-child' | 'is-parent' | 'is-ancestor';
|
14
14
|
export type HeroContentType = 'head' | 'body' | 'foot';
|
15
15
|
export type MediaSectionType = 'left' | 'content' | 'right';
|
16
|
+
export type NavBarFixedPositionType = 'top' | 'bottom';
|
package/dist/esm/index.js
CHANGED
@@ -3317,6 +3317,16 @@ const Tile = ({ testId = null, cssClasses = null, style = null, children, contex
|
|
3317
3317
|
return (React.createElement("section", { "data-testid": tileTestId, className: tileClasses, style: style !== null && style !== void 0 ? style : undefined }, children));
|
3318
3318
|
};
|
3319
3319
|
|
3320
|
+
const NavBarItem = ({ testId = null, cssClasses = null, style = null, children, isActive = false, onClick = null }) => {
|
3321
|
+
const navBarItemClasses = parseClasses([
|
3322
|
+
'navbar-item',
|
3323
|
+
isActive ? 'is-active' : null,
|
3324
|
+
cssClasses
|
3325
|
+
]);
|
3326
|
+
const navBarItemTestId = testId !== null && testId !== void 0 ? testId : parseTestId({ tag: 'navbar-item', parsedClasses: navBarItemClasses });
|
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
|
+
};
|
3329
|
+
|
3320
3330
|
const generateKey = (max = 5000, min = 1) => {
|
3321
3331
|
max = Math.floor(max);
|
3322
3332
|
min = Math.ceil(min);
|
@@ -3733,6 +3743,94 @@ const Section = ({ testId = null, cssClasses = null, style = null, content, size
|
|
3733
3743
|
return (React.createElement("section", { "data-testid": sectionTestId, className: sectionClasses, style: style !== null && style !== void 0 ? style : undefined }, content));
|
3734
3744
|
};
|
3735
3745
|
|
3746
|
+
/******************************************************************************
|
3747
|
+
Copyright (c) Microsoft Corporation.
|
3748
|
+
|
3749
|
+
Permission to use, copy, modify, and/or distribute this software for any
|
3750
|
+
purpose with or without fee is hereby granted.
|
3751
|
+
|
3752
|
+
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
3753
|
+
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
3754
|
+
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
3755
|
+
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
3756
|
+
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
3757
|
+
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
3758
|
+
PERFORMANCE OF THIS SOFTWARE.
|
3759
|
+
***************************************************************************** */
|
3760
|
+
/* global Reflect, Promise, SuppressedError, Symbol */
|
3761
|
+
|
3762
|
+
|
3763
|
+
function __rest(s, e) {
|
3764
|
+
var t = {};
|
3765
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
3766
|
+
t[p] = s[p];
|
3767
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
3768
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
3769
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
3770
|
+
t[p[i]] = s[p[i]];
|
3771
|
+
}
|
3772
|
+
return t;
|
3773
|
+
}
|
3774
|
+
|
3775
|
+
typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
|
3776
|
+
var e = new Error(message);
|
3777
|
+
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
|
3778
|
+
};
|
3779
|
+
|
3780
|
+
const NavBarBrand = ({ testId = null, cssClasses = null, style = null, brandConfig, isBurgerActive = false }) => {
|
3781
|
+
const navBarBrandClasses = parseClasses(['navbar-brand', cssClasses]);
|
3782
|
+
const navBarBrandTestId = testId !== null && testId !== void 0 ? testId : parseTestId({ tag: 'navbar-brand', parsedClasses: navBarBrandClasses });
|
3783
|
+
const navBarBurgerClasses = parseClasses([
|
3784
|
+
'navbar-burger',
|
3785
|
+
isBurgerActive ? 'is-active' : null
|
3786
|
+
]);
|
3787
|
+
const navBarBurgerTestId = parseTestId({
|
3788
|
+
tag: 'navbar-burger',
|
3789
|
+
parsedClasses: navBarBurgerClasses
|
3790
|
+
});
|
3791
|
+
const { children } = brandConfig, brandItemConfig = __rest(brandConfig, ["children"]);
|
3792
|
+
return (React.createElement("section", { "data-testid": navBarBrandTestId, className: navBarBrandClasses, style: style !== null && style !== void 0 ? style : undefined },
|
3793
|
+
React.createElement(NavBarItem, Object.assign({}, brandItemConfig),
|
3794
|
+
React.createElement(Image, Object.assign({}, children))),
|
3795
|
+
React.createElement("a", { role: 'button', "data-testid": navBarBurgerTestId, className: navBarBurgerClasses, "aria-label": 'menu', "aria-expanded": 'false' },
|
3796
|
+
React.createElement("span", { "aria-hidden": 'true' }),
|
3797
|
+
React.createElement("span", { "aria-hidden": 'true' }),
|
3798
|
+
React.createElement("span", { "aria-hidden": 'true' }))));
|
3799
|
+
};
|
3800
|
+
|
3801
|
+
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)));
|
3802
|
+
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 }) => {
|
3803
|
+
const navBarDropdownContainerClasses = parseClasses([
|
3804
|
+
'navbar-item',
|
3805
|
+
'has-dropdown',
|
3806
|
+
position,
|
3807
|
+
isActive ? 'is-active' : null,
|
3808
|
+
isHoverable ? 'is-hoverable' : null,
|
3809
|
+
hasDropdownUp ? 'has-dropdown-up' : null,
|
3810
|
+
containerCssClasses
|
3811
|
+
]);
|
3812
|
+
const navBarDropdownContainerTestId = containerTestId !== null && containerTestId !== void 0 ? containerTestId : parseTestId({
|
3813
|
+
tag: 'navbar-dropdown-container',
|
3814
|
+
parsedClasses: navBarDropdownContainerClasses,
|
3815
|
+
rules: [
|
3816
|
+
{ regExp: /navbar-item|has-dropdown/gm, replacer: '' },
|
3817
|
+
{ regExp: /is-|has-/gm, replacer: '-' }
|
3818
|
+
]
|
3819
|
+
});
|
3820
|
+
const navBarDropdownClasses = parseClasses([
|
3821
|
+
'navbar-dropdown',
|
3822
|
+
hasBoxedMenu ? 'is-boxed' : null,
|
3823
|
+
cssClasses
|
3824
|
+
]);
|
3825
|
+
const navBarDropdownTestId = testId !== null && testId !== void 0 ? testId : parseTestId({
|
3826
|
+
tag: 'navbar-dropdown',
|
3827
|
+
parsedClasses: navBarDropdownClasses
|
3828
|
+
});
|
3829
|
+
return (React.createElement("section", { "data-testid": navBarDropdownContainerTestId, className: navBarDropdownContainerClasses, style: containerStyle !== null && containerStyle !== void 0 ? containerStyle : undefined },
|
3830
|
+
React.createElement("a", { className: 'navbar-link', "aria-hidden": 'true' }, text),
|
3831
|
+
React.createElement("section", { "data-testid": navBarDropdownTestId, className: navBarDropdownClasses, style: style !== null && style !== void 0 ? style : undefined }, items.map(renderDropdownItem))));
|
3832
|
+
};
|
3833
|
+
|
3736
3834
|
const renderFieldLabel = (labelText) => labelText ? (React.createElement("label", { "data-testid": 'test-form-field-label', className: 'label' }, labelText)) : null;
|
3737
3835
|
const renderFieldBody = (inputControlConfig, isGrouped) => {
|
3738
3836
|
if (isGrouped) {
|
@@ -3835,5 +3933,31 @@ const TileGroup = ({ testId = null, cssClasses = null, style = null, context = '
|
|
3835
3933
|
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))))));
|
3836
3934
|
};
|
3837
3935
|
|
3838
|
-
|
3936
|
+
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;
|
3937
|
+
const NavBar = ({ testId = null, cssClasses = null, style = null, brandConfig = null, itemsAtStart = null, itemsAtEnd = null, fixedPosition = null, color = null, isTransparent = false, isSpaced = false, hasShadow = false }) => {
|
3938
|
+
const navBarClasses = parseClasses([
|
3939
|
+
'navbar',
|
3940
|
+
fixedPosition,
|
3941
|
+
color,
|
3942
|
+
isTransparent ? 'is-transparent' : null,
|
3943
|
+
isSpaced ? 'is-spaced' : null,
|
3944
|
+
hasShadow ? 'has-shadow' : null,
|
3945
|
+
cssClasses
|
3946
|
+
]);
|
3947
|
+
const navBarTestId = testId !== null && testId !== void 0 ? testId : parseTestId({
|
3948
|
+
tag: 'navbar',
|
3949
|
+
parsedClasses: navBarClasses,
|
3950
|
+
rules: [
|
3951
|
+
{ regExp: /is-|has-/gm, replacer: '-' },
|
3952
|
+
{ regExp: /navbar/gm, replacer: '' }
|
3953
|
+
]
|
3954
|
+
});
|
3955
|
+
return (React.createElement("nav", { "data-testid": navBarTestId, className: navBarClasses, style: style !== null && style !== void 0 ? style : undefined },
|
3956
|
+
brandConfig ? (React.createElement("section", { "data-testid": 'navbar-brand', className: 'navbar-brand' }, React.createElement(NavBarBrand, Object.assign({}, brandConfig)))) : null,
|
3957
|
+
React.createElement("section", { className: 'navbar-menu' },
|
3958
|
+
renderNavBarMenuSection(itemsAtStart, 'start', navBarTestId),
|
3959
|
+
renderNavBarMenuSection(itemsAtEnd, 'end', navBarTestId))));
|
3960
|
+
};
|
3961
|
+
|
3962
|
+
export { Block, Box, BreadcrumbItem, Breadcrumbs, Button, ButtonGroup, 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 };
|
3839
3963
|
//# sourceMappingURL=index.js.map
|