@allxsmith/bestax-bulma 5.4.2 → 5.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bestax.css +1 -1
- package/dist/bestax.css.map +1 -1
- package/dist/extras.css +1 -1
- package/dist/extras.css.map +1 -1
- package/dist/index.cjs.js +35 -17
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +35 -17
- package/dist/index.esm.js.map +1 -1
- package/dist/types/columns/Columns.d.ts +8 -1
- package/dist/types/components/Avatars.d.ts +1 -0
- package/dist/types/grid/Grid.d.ts +1 -1
- package/dist/versions/bestax-no-dark-mode.css +1 -1
- package/dist/versions/bestax-no-dark-mode.css.map +1 -1
- package/dist/versions/bestax-no-helpers-prefixed.css +1 -1
- package/dist/versions/bestax-no-helpers-prefixed.css.map +1 -1
- package/dist/versions/bestax-no-helpers.css +1 -1
- package/dist/versions/bestax-no-helpers.css.map +1 -1
- package/dist/versions/bestax-prefixed.css +1 -1
- package/dist/versions/bestax-prefixed.css.map +1 -1
- package/package.json +1 -1
- package/src/scss/components/_avatars.scss +7 -0
- package/src/scss/components/_badge.scss +10 -0
package/dist/index.esm.js
CHANGED
|
@@ -680,7 +680,13 @@ const Column = ({ className, textColor, color: _fieldColor, bgColor, size, sizeM
|
|
|
680
680
|
return (jsx("div", { className: columnClasses, ...rest, children: children }));
|
|
681
681
|
};
|
|
682
682
|
|
|
683
|
-
const Columns = ({ className, textColor, color: _fieldColor, bgColor, isCentered, isGapless, isMultiline, isVCentered, isMobile, isDesktop, gapSize, gapSizeMobile, gapSizeTablet, gapSizeDesktop, gapSizeWidescreen, gapSizeFullhd, children, ...props }) => {
|
|
683
|
+
const Columns = ({ className, textColor, color: _fieldColor, bgColor, isCentered, isGapless, isMultiline, isVCentered, isMobile, isDesktop, gap, gapMobile, gapTablet, gapDesktop, gapWidescreen, gapFullhd, gapSize, gapSizeMobile, gapSizeTablet, gapSizeDesktop, gapSizeWidescreen, gapSizeFullhd, children, ...props }) => {
|
|
684
|
+
const resolvedGap = gap ?? gapSize;
|
|
685
|
+
const resolvedGapMobile = gapMobile ?? gapSizeMobile;
|
|
686
|
+
const resolvedGapTablet = gapTablet ?? gapSizeTablet;
|
|
687
|
+
const resolvedGapDesktop = gapDesktop ?? gapSizeDesktop;
|
|
688
|
+
const resolvedGapWidescreen = gapWidescreen ?? gapSizeWidescreen;
|
|
689
|
+
const resolvedGapFullhd = gapFullhd ?? gapSizeFullhd;
|
|
684
690
|
const { bulmaHelperClasses, rest } = useBulmaClasses({
|
|
685
691
|
color: textColor,
|
|
686
692
|
backgroundColor: bgColor,
|
|
@@ -688,12 +694,12 @@ const Columns = ({ className, textColor, color: _fieldColor, bgColor, isCentered
|
|
|
688
694
|
});
|
|
689
695
|
const mainClass = usePrefixedClassNames('columns');
|
|
690
696
|
const gapClasses = usePrefixedClassNames('', {
|
|
691
|
-
[`is-${
|
|
692
|
-
[`is-${
|
|
693
|
-
[`is-${
|
|
694
|
-
[`is-${
|
|
695
|
-
[`is-${
|
|
696
|
-
[`is-${
|
|
697
|
+
[`is-${resolvedGap}`]: resolvedGap !== undefined && resolvedGap !== null,
|
|
698
|
+
[`is-${resolvedGapMobile}-mobile`]: resolvedGapMobile !== undefined && resolvedGapMobile !== null,
|
|
699
|
+
[`is-${resolvedGapTablet}-tablet`]: resolvedGapTablet !== undefined && resolvedGapTablet !== null,
|
|
700
|
+
[`is-${resolvedGapDesktop}-desktop`]: resolvedGapDesktop !== undefined && resolvedGapDesktop !== null,
|
|
701
|
+
[`is-${resolvedGapWidescreen}-widescreen`]: resolvedGapWidescreen !== undefined && resolvedGapWidescreen !== null,
|
|
702
|
+
[`is-${resolvedGapFullhd}-fullhd`]: resolvedGapFullhd !== undefined && resolvedGapFullhd !== null,
|
|
697
703
|
'is-centered': !!isCentered,
|
|
698
704
|
'is-gapless': !!isGapless,
|
|
699
705
|
'is-multiline': !!isMultiline,
|
|
@@ -794,16 +800,26 @@ const Avatar = ({ className, src, alt, name, initials, icon, size, shape = 'circ
|
|
|
794
800
|
const combinedClasses = classNames(avatarClasses, bulmaHelperClasses, className);
|
|
795
801
|
const initialsClass = usePrefixedClassNames('avatar-initials');
|
|
796
802
|
const Tag = as ?? (href ? 'a' : 'figure');
|
|
797
|
-
const isInteractive = Tag === 'a' ||
|
|
803
|
+
const isInteractive = Tag === 'a' ||
|
|
804
|
+
Tag === 'button' ||
|
|
805
|
+
(typeof Tag !== 'string' && href != null);
|
|
798
806
|
const isLinkLike = Tag === 'a' || typeof Tag !== 'string';
|
|
799
807
|
const linkProps = isLinkLike ? { href, target, rel } : {};
|
|
808
|
+
const accessibleName = alt ?? name;
|
|
809
|
+
const isDecorative = alt === '' && !isInteractive;
|
|
800
810
|
const a11yProps = showImage
|
|
801
|
-
?
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
811
|
+
? isInteractive && !accessibleName
|
|
812
|
+
?
|
|
813
|
+
{ 'aria-label': name || 'Avatar' }
|
|
814
|
+
: {}
|
|
815
|
+
: isDecorative
|
|
816
|
+
? { 'aria-hidden': true }
|
|
817
|
+
: {
|
|
818
|
+
...(isInteractive ? {} : { role: 'img' }),
|
|
819
|
+
'aria-label': accessibleName || name || 'Avatar',
|
|
820
|
+
};
|
|
821
|
+
const buttonTypeProps = Tag === 'button' ? { type: 'button' } : {};
|
|
822
|
+
return (jsxs(Tag, { className: combinedClasses, style: { ...sizeStyle, ...style }, ...buttonTypeProps, ...linkProps, ...a11yProps, ...rest, children: [showImage && (jsx("img", { ...imageProps, ref: imgRef, src: src, alt: accessibleName ?? '', onError: e => {
|
|
807
823
|
imageProps?.onError?.(e);
|
|
808
824
|
setErroredSrc(src);
|
|
809
825
|
} }, src)), showInitials && (jsx("span", { className: initialsClass, children: resolvedInitials })), showIcon && icon, showDefaultIcon && jsx(DefaultAvatarIcon, {})] }));
|
|
@@ -823,7 +839,7 @@ function flattenChildren(children, keyPrefix = '') {
|
|
|
823
839
|
];
|
|
824
840
|
});
|
|
825
841
|
}
|
|
826
|
-
const Avatars = ({ className, max, size, shape, spacing = 'md', spaced = false, style, children, ...props }) => {
|
|
842
|
+
const Avatars = ({ className, max, size, shape, spacing = 'md', spaced = false, surplusLabel, style, children, ...props }) => {
|
|
827
843
|
const { bulmaHelperClasses, rest } = useBulmaClasses({ ...props });
|
|
828
844
|
const isPresetSpacing = typeof spacing === 'string';
|
|
829
845
|
const avatarsClasses = usePrefixedClassNames('avatars', {
|
|
@@ -846,7 +862,7 @@ const Avatars = ({ className, max, size, shape, spacing = 'md', spaced = false,
|
|
|
846
862
|
return (jsxs("div", { className: combinedClasses, style: { ...spacingStyle, ...style }, ...rest, children: [visibleChildren.map(child => React.cloneElement(child, {
|
|
847
863
|
...(size !== undefined ? { size } : {}),
|
|
848
864
|
...(shape !== undefined ? { shape } : {}),
|
|
849
|
-
})), overflowCount > 0 && (jsx(Avatar, { initials: `+${overflowCount}`, alt: `${overflowCount} more`, size: size, shape: shape, className: surplusClass }))] }));
|
|
865
|
+
})), overflowCount > 0 && (jsx(Avatar, { initials: `+${overflowCount}`, alt: surplusLabel?.(overflowCount) || `${overflowCount} more`, size: size, shape: shape, className: surplusClass }))] }));
|
|
850
866
|
};
|
|
851
867
|
Avatars.displayName = 'Avatars';
|
|
852
868
|
Avatars.Avatar = Avatar;
|
|
@@ -872,7 +888,8 @@ const Badge = ({ className, badgeClassName, content, max = 99, dot = false, show
|
|
|
872
888
|
content !== true &&
|
|
873
889
|
content !== '' &&
|
|
874
890
|
(!isZero || showZero);
|
|
875
|
-
const
|
|
891
|
+
const zeroPlaceholder = isZero && !showZero && !dot && !invisible;
|
|
892
|
+
const shouldRender = dot || hasContent || invisible || zeroPlaceholder;
|
|
876
893
|
const sanitizedMax = Number.isInteger(max) && max >= 0 ? max : 99;
|
|
877
894
|
const displayValue = useMemo(() => {
|
|
878
895
|
if (dot || !hasContent)
|
|
@@ -894,6 +911,7 @@ const Badge = ({ className, badgeClassName, content, max = 99, dot = false, show
|
|
|
894
911
|
'is-dot': dot,
|
|
895
912
|
'is-pulse': pulse,
|
|
896
913
|
'is-invisible': invisible,
|
|
914
|
+
'is-zero': zeroPlaceholder,
|
|
897
915
|
});
|
|
898
916
|
const pillClass = hasChildren
|
|
899
917
|
? classNames(badgeClasses, badgeClassName)
|