@allxsmith/bestax-bulma 5.16.9 → 5.16.11

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/index.cjs CHANGED
@@ -1690,18 +1690,6 @@ const Breadcrumb = ({ className, alignment, separator, size, children, ...props
1690
1690
  */
1691
1691
  const mergeBulmaStyles = (helperStyles, style) => helperStyles || style ? { ...helperStyles, ...style } : undefined;
1692
1692
 
1693
- /**
1694
- * Wrap each footer item in a `.card-footer-item` span.
1695
- * @param {CardProps['footer']} footer - Footer content (single node or array).
1696
- * @param {string | undefined} classPrefix - Bulma class prefix.
1697
- * @returns {React.ReactNode[] | null} Wrapped footer items, or null if no footer.
1698
- */
1699
- const renderFooter = (footer, classPrefix) => {
1700
- if (!footer)
1701
- return null;
1702
- const items = Array.isArray(footer) ? footer : [footer];
1703
- return items.map((item, idx) => (jsxRuntime.jsx("span", { className: prefixedClassNames(classPrefix, 'card-footer-item'), children: item }, idx)));
1704
- };
1705
1693
  /**
1706
1694
  * Check if children contain any Card compound sub-components.
1707
1695
  * @param {React.ReactNode} children - The children to inspect.
@@ -1749,6 +1737,9 @@ const CardComponent = ({ className, children, textColor, color, bgColor, hasShad
1749
1737
  'is-centered': headerCentered,
1750
1738
  }), children: header })), headerIcon] }));
1751
1739
  };
1740
+ // Any falsy footer (including `0`) and an empty array render no footer bar,
1741
+ // rather than a stray `0` or an empty `.card-footer`.
1742
+ const hasFooter = Array.isArray(footer) ? footer.length > 0 : Boolean(footer);
1752
1743
  return (jsxRuntime.jsxs("div", { className: cardClasses, style: mergeBulmaStyles(bulmaHelperStyles, style), ...rest, children: [renderHeader(header, headerIcon, headerCentered, classPrefix), image && (jsxRuntime.jsx("div", { className: prefixedClassNames(classPrefix, 'card-image'), children: typeof image === 'string' ? (jsxRuntime.jsx("figure", { className: prefixedClassNames(classPrefix, 'image'), children: jsxRuntime.jsx("img", { src: image, alt: imageAlt ?? 'Card image' }) })) : (image) })), typeof children !== 'undefined' &&
1753
1744
  children !== null &&
1754
1745
  children !== '' &&
@@ -1756,9 +1747,7 @@ const CardComponent = ({ className, children, textColor, color, bgColor, hasShad
1756
1747
  children !== null &&
1757
1748
  children !== '' &&
1758
1749
  hasCompoundComponents(children) &&
1759
- children, footer && (jsxRuntime.jsx("footer", { className: prefixedClassNames(classPrefix, 'card-footer'), children: Array.isArray(footer)
1760
- ? footer.map((item, idx) => (jsxRuntime.jsx("span", { className: prefixedClassNames(classPrefix, 'card-footer-item'), children: item }, idx)))
1761
- : footer && (jsxRuntime.jsx("span", { className: prefixedClassNames(classPrefix, 'card-footer-item'), children: footer })) }))] }));
1750
+ children, hasFooter && (jsxRuntime.jsx("footer", { className: prefixedClassNames(classPrefix, 'card-footer'), children: Array.isArray(footer) ? (footer.map((item, idx) => (jsxRuntime.jsx("span", { className: prefixedClassNames(classPrefix, 'card-footer-item'), children: item }, idx)))) : (jsxRuntime.jsx("span", { className: prefixedClassNames(classPrefix, 'card-footer-item'), children: footer })) }))] }));
1762
1751
  };
1763
1752
  /**
1764
1753
  * Card header compound component. Wraps children in a `.card-header` element.
@@ -1888,8 +1877,6 @@ const Card = withSubComponents(CardComponent, {
1888
1877
  Footer: CardFooter,
1889
1878
  FooterItem: CardFooterItem,
1890
1879
  }, 'Card');
1891
- /** Internal test-only exports. Not part of the public API. */
1892
- const __test_exports__ = { renderFooter };
1893
1880
 
1894
1881
  /**
1895
1882
  * The runtime mirror of `AnchorOnlyAttributes`, keyed so the two cannot drift.
@@ -1962,6 +1949,9 @@ function omitAttrs(props, strip) {
1962
1949
 
1963
1950
  /**
1964
1951
  * Checks if code is running in a browser environment.
1952
+ * @deprecated Dropdown's internal SSR guard, exported by accident; it will
1953
+ * be removed in the next major. Check `typeof window !== 'undefined' &&
1954
+ * typeof document !== 'undefined'` instead.
1965
1955
  * @param win - Window object.
1966
1956
  * @param doc - Document object.
1967
1957
  * @returns {boolean} True if in browser, false otherwise.
@@ -2064,7 +2054,10 @@ const DropdownComponent = React.forwardRef(function DropdownComponent({ label, c
2064
2054
  /* istanbul ignore next: dropdownRef.current is never null once mounted */
2065
2055
  if (!dropdownRef.current)
2066
2056
  return [];
2067
- return Array.from(dropdownRef.current.querySelectorAll('[role="menuitem"]')).filter(el => !el.hasAttribute('disabled') &&
2057
+ return Array.from(
2058
+ // Every menu-item role, so an item a caller gives `menuitemcheckbox`
2059
+ // or `menuitemradio` (a filter or sort menu) stays reachable.
2060
+ dropdownRef.current.querySelectorAll('[role="menuitem"], [role="menuitemcheckbox"], [role="menuitemradio"]')).filter(el => !el.hasAttribute('disabled') &&
2068
2061
  el.getAttribute('aria-disabled') !== 'true');
2069
2062
  };
2070
2063
  // Focus the pending menu item once the menu becomes visible; the item is
@@ -2232,7 +2225,11 @@ const DropdownItem = ((itemProps) => {
2232
2225
  const forwarded = Component === 'a' ? rest : omitAttrs(rest, STRIP_FROM_NON_ANCHOR$1);
2233
2226
  return (jsxRuntime.jsx(Component, { className: classNames(usePrefixedClassNames('dropdown-item', {
2234
2227
  'is-active': active,
2235
- }), bulmaHelperClasses, className), tabIndex: 0, role: "menuitem", "data-testid": "dropdown-item", ...forwarded, ...(Component === 'button'
2228
+ }), bulmaHelperClasses, className), tabIndex: 0, "data-testid": "dropdown-item", ...forwarded,
2229
+ // After `forwarded` for the same reason as `type` below: a spread
2230
+ // carrying `role: undefined` would otherwise erase the default, and an
2231
+ // item with no role drops out of the menu and its arrow-key order.
2232
+ role: forwarded.role ?? 'menuitem', ...(Component === 'button'
2236
2233
  ? {
2237
2234
  type: forwarded.type ?? 'button',
2238
2235
  }
@@ -2292,7 +2289,7 @@ const MenuList = ({ className, children, ...props }) => {
2292
2289
  [usePrefixedClassNames('menu-list')]: level === 0,
2293
2290
  });
2294
2291
  // Increment level for nested MenuLists
2295
- return (jsxRuntime.jsx(MenuListLevelContext.Provider, { value: level + 1, children: jsxRuntime.jsx("ul", { className: ulClass, ...rest, children: children }) }));
2292
+ return (jsxRuntime.jsx(MenuListLevelContext.Provider, { value: level + 1, children: jsxRuntime.jsx("ul", { className: ulClass || undefined, ...rest, children: children }) }));
2296
2293
  };
2297
2294
  /**
2298
2295
  * `href` alone — annotated so a typo is a compile error rather than a silent
@@ -2344,7 +2341,7 @@ const MenuItem = React.forwardRef(function MenuItem(itemProps, ref) {
2344
2341
  labelChildren.push(child);
2345
2342
  }
2346
2343
  });
2347
- return (jsxRuntime.jsxs("li", { className: className, "data-testid": testId, style: style, id: id, title: title, role: role, tabIndex: tabIndex, children: [jsxRuntime.jsx(Component, { ref: ref, className: itemClass, ...linkProps, children: labelChildren }), nestedMenuLists] }));
2344
+ return (jsxRuntime.jsxs("li", { className: className, "data-testid": testId, style: style, id: id, title: title, role: role, tabIndex: tabIndex, children: [jsxRuntime.jsx(Component, { ref: ref, className: itemClass || undefined, ...linkProps, children: labelChildren }), nestedMenuLists] }));
2348
2345
  });
2349
2346
  MenuItem.displayName = 'MenuItem';
2350
2347
  // Attach static subcomponents
@@ -2846,9 +2843,9 @@ const NavbarComponent = React.forwardRef(function NavbarComponent({ className, t
2846
2843
  * @param {NavbarBrandProps} props - Props for the NavbarBrand component.
2847
2844
  * @returns {JSX.Element} The rendered brand area.
2848
2845
  */
2849
- const NavbarBrand = ({ className, children, textColor, ...props }) => {
2846
+ const NavbarBrand = ({ className, children, textColor, color, ...props }) => {
2850
2847
  const { bulmaHelperClasses, rest } = useBulmaClasses({
2851
- color: textColor,
2848
+ color: textColor ?? color,
2852
2849
  ...props,
2853
2850
  });
2854
2851
  return (jsxRuntime.jsx("div", { className: classNames(usePrefixedClassNames('navbar-brand'), bulmaHelperClasses, className), ...rest, children: children }));
@@ -2881,13 +2878,14 @@ NavbarItem.displayName = 'NavbarItem';
2881
2878
  * @param {React.Ref<HTMLButtonElement>} ref - Forwarded ref to the burger button element.
2882
2879
  * @returns {JSX.Element} The rendered burger.
2883
2880
  */
2884
- const NavbarBurger = React.forwardRef(function NavbarBurger({ className, active, children, ...props }, ref) {
2881
+ const NavbarBurger = React.forwardRef(function NavbarBurger({ className, active, textColor, color, children, ...props }, ref) {
2885
2882
  const { bulmaHelperClasses, rest } = useBulmaClasses({
2883
+ color: textColor ?? color,
2886
2884
  ...props,
2887
2885
  });
2888
2886
  return (jsxRuntime.jsxs("button", { ref: ref, type: "button", className: classNames(usePrefixedClassNames('navbar-burger', {
2889
2887
  'is-active': active,
2890
- }), bulmaHelperClasses, className), "aria-label": props['aria-label'] || 'menu', "aria-expanded": props['aria-expanded'] ?? !!active, ...rest, children: [jsxRuntime.jsx("span", { "aria-hidden": "true" }), jsxRuntime.jsx("span", { "aria-hidden": "true" }), jsxRuntime.jsx("span", { "aria-hidden": "true" }), children] }));
2888
+ }), bulmaHelperClasses, className), "aria-label": props['aria-label'] || 'menu', "aria-expanded": props['aria-expanded'] ?? !!active, ...rest, children: [jsxRuntime.jsx("span", { "aria-hidden": "true" }), jsxRuntime.jsx("span", { "aria-hidden": "true" }), jsxRuntime.jsx("span", { "aria-hidden": "true" }), jsxRuntime.jsx("span", { "aria-hidden": "true" }), children] }));
2891
2889
  });
2892
2890
  NavbarBurger.displayName = 'NavbarBurger';
2893
2891
  /**
@@ -2897,8 +2895,9 @@ NavbarBurger.displayName = 'NavbarBurger';
2897
2895
  * @param {NavbarMenuProps} props - Props for the NavbarMenu component.
2898
2896
  * @returns {JSX.Element} The rendered menu.
2899
2897
  */
2900
- const NavbarMenu = ({ className, active, children, ...props }) => {
2898
+ const NavbarMenu = ({ className, active, textColor, color, children, ...props }) => {
2901
2899
  const { bulmaHelperClasses, rest } = useBulmaClasses({
2900
+ color: textColor ?? color,
2902
2901
  ...props,
2903
2902
  });
2904
2903
  return (jsxRuntime.jsx("div", { className: classNames(usePrefixedClassNames('navbar-menu', {
@@ -2912,8 +2911,9 @@ const NavbarMenu = ({ className, active, children, ...props }) => {
2912
2911
  * @param {NavbarStartEndProps} props - Props for the NavbarStart component.
2913
2912
  * @returns {JSX.Element} The rendered start area.
2914
2913
  */
2915
- const NavbarStart = ({ className, children, ...props }) => {
2914
+ const NavbarStart = ({ className, textColor, color, children, ...props }) => {
2916
2915
  const { bulmaHelperClasses, rest } = useBulmaClasses({
2916
+ color: textColor ?? color,
2917
2917
  ...props,
2918
2918
  });
2919
2919
  return (jsxRuntime.jsx("div", { className: classNames(usePrefixedClassNames('navbar-start'), bulmaHelperClasses, className), ...rest, children: children }));
@@ -2925,8 +2925,9 @@ const NavbarStart = ({ className, children, ...props }) => {
2925
2925
  * @param {NavbarStartEndProps} props - Props for the NavbarEnd component.
2926
2926
  * @returns {JSX.Element} The rendered end area.
2927
2927
  */
2928
- const NavbarEnd = ({ className, children, ...props }) => {
2928
+ const NavbarEnd = ({ className, textColor, color, children, ...props }) => {
2929
2929
  const { bulmaHelperClasses, rest } = useBulmaClasses({
2930
+ color: textColor ?? color,
2930
2931
  ...props,
2931
2932
  });
2932
2933
  return (jsxRuntime.jsx("div", { className: classNames(usePrefixedClassNames('navbar-end'), bulmaHelperClasses, className), ...rest, children: children }));
@@ -3072,7 +3073,7 @@ const NavbarDropdownMenu = ({ className, right, up, children, ...props }) => (js
3072
3073
  * @param {React.HTMLAttributes<HTMLHRElement>} props - Standard hr props.
3073
3074
  * @returns {JSX.Element} The rendered divider.
3074
3075
  */
3075
- const NavbarDivider = props => (jsxRuntime.jsx("hr", { className: usePrefixedClassNames('navbar-divider'), ...props }));
3076
+ const NavbarDivider = ({ className, ...props }) => (jsxRuntime.jsx("hr", { className: classNames(usePrefixedClassNames('navbar-divider'), className), ...props }));
3076
3077
  // Attach subcomponents
3077
3078
  const Navbar = withSubComponents(NavbarComponent, {
3078
3079
  Brand: NavbarBrand,
@@ -3690,7 +3691,7 @@ const TabsComponent = ({ align, size, isFullwidth, isFullWidth, fullwidth, boxed
3690
3691
  * @param {TabListProps} props - Props for the TabList component.
3691
3692
  * @returns {JSX.Element} The rendered tab list.
3692
3693
  */
3693
- const TabList = ({ className, children, ...props }) => (jsxRuntime.jsx("ul", { role: "tablist", className: classNames(className), ...props, children: children }));
3694
+ const TabList = ({ className, children, ...props }) => (jsxRuntime.jsx("ul", { role: "tablist", className: classNames(className) || undefined, ...props, children: children }));
3694
3695
  /**
3695
3696
  * Individual tab button. Consumes Tabs context for active state management.
3696
3697
  * Renders `<a>` internally — consumers provide only the label text/children.
@@ -3709,7 +3710,7 @@ const Tab = ({ index, disabled, icon, iconLibrary, iconVariant, iconSize = 'smal
3709
3710
  ctx.setActiveTab(index);
3710
3711
  }
3711
3712
  }, [disabled, ctx, index]);
3712
- return (jsxRuntime.jsx("li", { className: classNames(activeClass, className), role: "tab", "aria-selected": isActive, tabIndex: disabled ? -1 : 0, ...props, children: jsxRuntime.jsxs("a", { onClick: handleClick, "aria-disabled": disabled || undefined, children: [icon && (jsxRuntime.jsx(Icon, { name: icon, library: iconLibrary, variant: iconVariant, size: iconSize, features: iconFeatures })), children && jsxRuntime.jsx("span", { children: children })] }) }));
3713
+ return (jsxRuntime.jsx("li", { className: classNames(activeClass, className) || undefined, role: "tab", "aria-selected": isActive, tabIndex: disabled ? -1 : 0, ...props, children: jsxRuntime.jsxs("a", { onClick: handleClick, "aria-disabled": disabled || undefined, children: [icon && (jsxRuntime.jsx(Icon, { name: icon, library: iconLibrary, variant: iconVariant, size: iconSize, features: iconFeatures })), children && jsxRuntime.jsx("span", { children: children })] }) }));
3713
3714
  };
3714
3715
  /**
3715
3716
  * Each tab; accepts `active`, `onClick`, etc.
@@ -3719,7 +3720,8 @@ const Tab = ({ index, disabled, icon, iconLibrary, iconVariant, iconSize = 'smal
3719
3720
  * @returns {JSX.Element} The rendered tab item.
3720
3721
  * @deprecated Use `Tabs.Tab` with an `index` prop instead.
3721
3722
  */
3722
- const TabItem = ({ active, className, children, onClick, ...props }) => (jsxRuntime.jsx("li", { className: classNames({ [usePrefixedClassNames('is-active')]: active }, className), onClick: onClick, ...props, children: children }));
3723
+ const TabItem = ({ active, className, children, onClick, ...props }) => (jsxRuntime.jsx("li", { className: classNames({ [usePrefixedClassNames('is-active')]: active }, className) ||
3724
+ undefined, onClick: onClick, ...props, children: children }));
3723
3725
  /**
3724
3726
  * Container for tab content panels. No custom props beyond `children` and standard `<div>` HTML attributes. Applies the `.tabs-content` class.
3725
3727
  *
@@ -5969,7 +5971,7 @@ const Image = ({ as, className, textColor, color, bgColor, size, isRounded, isRe
5969
5971
  Tag = 'div';
5970
5972
  }
5971
5973
  const roundedClass = usePrefixedClassNames('is-rounded');
5972
- const content = children ? (children) : (jsxRuntime.jsx("img", { className: classNames({ [roundedClass]: isRounded }), src: src, alt: alt, ...(isRetina && src ? { srcSet: `${src} 2x` } : {}) }));
5974
+ const content = children ? (children) : (jsxRuntime.jsx("img", { className: classNames({ [roundedClass]: isRounded }) || undefined, src: src, alt: alt, ...(isRetina && src ? { srcSet: `${src} 2x` } : {}) }));
5973
5975
  return (jsxRuntime.jsx(Tag, { className: imageClasses, ...rest, children: content }));
5974
5976
  };
5975
5977
 
@@ -6169,6 +6171,7 @@ const notification = {
6169
6171
  const NotificationItem = ({ instance, onClose }) => {
6170
6172
  const { message, color, isLight, duration = 3000, hasDelete = true, indefinite = false, pauseOnHover = true, } = instance.options;
6171
6173
  const [isPaused, setIsPaused] = React.useState(false);
6174
+ const urgent = color === 'danger' || color === 'warning';
6172
6175
  const handleClose = React.useCallback(() => {
6173
6176
  onClose(instance.id);
6174
6177
  }, [onClose, instance.id]);
@@ -6187,11 +6190,13 @@ const NotificationItem = ({ instance, onClose }) => {
6187
6190
  if (pauseOnHover)
6188
6191
  setIsPaused(false);
6189
6192
  }, [pauseOnHover]);
6190
- return (jsxRuntime.jsx(Notification, { color: color, isLight: isLight, hasDelete: hasDelete, onDelete: handleClose, onMouseEnter: handleMouseEnter, onMouseLeave: handleMouseLeave, style: { pointerEvents: 'auto' }, children: message }));
6193
+ return (jsxRuntime.jsx(Notification, { color: color, isLight: isLight, hasDelete: hasDelete, onDelete: handleClose, onMouseEnter: handleMouseEnter, onMouseLeave: handleMouseLeave, style: { pointerEvents: 'auto' }, children: urgent ? (jsxRuntime.jsx("span", { role: "alert", "aria-live": "assertive", children: message })) : (jsxRuntime.jsx("span", { role: "status", "aria-live": "polite", children: message })) }));
6191
6194
  };
6192
6195
  /**
6193
6196
  * Container component for rendering programmatic notifications.
6194
- * Place once at your app root to enable the notification API.
6197
+ * Place once at your app root to enable the notification API. Mount it
6198
+ * before calling `notification`: a notification shown while no container is
6199
+ * mounted doesn't appear when one mounts, only alongside the next call.
6195
6200
  *
6196
6201
  * @function
6197
6202
  * @param {{ position?: NotificationPosition }} props - Container props.
@@ -6435,7 +6440,7 @@ const Thead = ({ className, children, ...props }) => {
6435
6440
  */
6436
6441
  const { bulmaHelperClasses, rest } = useBulmaClasses({ ...props });
6437
6442
  const theadClasses = classNames(className, bulmaHelperClasses);
6438
- return (jsxRuntime.jsx("thead", { className: theadClasses, ...rest, children: children }));
6443
+ return (jsxRuntime.jsx("thead", { className: theadClasses || undefined, ...rest, children: children }));
6439
6444
  };
6440
6445
 
6441
6446
  /**
@@ -6454,7 +6459,7 @@ const Tbody = ({ className, children, ...props }) => {
6454
6459
  */
6455
6460
  const { bulmaHelperClasses, rest } = useBulmaClasses({ ...props });
6456
6461
  const tbodyClasses = classNames(className, bulmaHelperClasses);
6457
- return (jsxRuntime.jsx("tbody", { className: tbodyClasses, ...rest, children: children }));
6462
+ return (jsxRuntime.jsx("tbody", { className: tbodyClasses || undefined, ...rest, children: children }));
6458
6463
  };
6459
6464
 
6460
6465
  /**
@@ -6473,7 +6478,7 @@ const Tfoot = ({ className, children, ...props }) => {
6473
6478
  */
6474
6479
  const { bulmaHelperClasses, rest } = useBulmaClasses({ ...props });
6475
6480
  const tfootClasses = classNames(className, bulmaHelperClasses);
6476
- return (jsxRuntime.jsx("tfoot", { className: tfootClasses, ...rest, children: children }));
6481
+ return (jsxRuntime.jsx("tfoot", { className: tfootClasses || undefined, ...rest, children: children }));
6477
6482
  };
6478
6483
 
6479
6484
  /** Valid Bulma color values for table cells. */
@@ -6508,7 +6513,7 @@ const Td = ({ className, color, children, ...props }) => {
6508
6513
  */
6509
6514
  const { bulmaHelperClasses, rest } = useBulmaClasses({ ...props });
6510
6515
  const tdClasses = classNames(colorClass, className, bulmaHelperClasses);
6511
- return (jsxRuntime.jsx("td", { className: tdClasses, ...rest, children: children }));
6516
+ return (jsxRuntime.jsx("td", { className: tdClasses || undefined, ...rest, children: children }));
6512
6517
  };
6513
6518
 
6514
6519
  /**
@@ -6531,7 +6536,7 @@ const Tr = ({ className, isSelected, color, children, ...props }) => {
6531
6536
  */
6532
6537
  const { bulmaHelperClasses, rest } = useBulmaClasses({ ...props });
6533
6538
  const trClasses = classNames(bulmaClasses, className, bulmaHelperClasses);
6534
- return (jsxRuntime.jsx("tr", { className: trClasses, ...rest, children: children }));
6539
+ return (jsxRuntime.jsx("tr", { className: trClasses || undefined, ...rest, children: children }));
6535
6540
  };
6536
6541
 
6537
6542
  const validAlignments = ['left', 'right', 'centered'];
@@ -6555,7 +6560,7 @@ const Th = ({ className, isAligned, width, color, children, ...props }) => {
6555
6560
  */
6556
6561
  const { bulmaHelperClasses, rest } = useBulmaClasses({ ...props });
6557
6562
  const thClasses = classNames(bulmaClasses, className, bulmaHelperClasses);
6558
- return (jsxRuntime.jsx("th", { className: thClasses, style: width
6563
+ return (jsxRuntime.jsx("th", { className: thClasses || undefined, style: width
6559
6564
  ? { width: typeof width === 'number' ? `${width}px` : width }
6560
6565
  : undefined, ...rest, children: children }));
6561
6566
  };
@@ -13494,7 +13499,6 @@ exports.ToastContainer = ToastContainer;
13494
13499
  exports.Tooltip = Tooltip;
13495
13500
  exports.Tr = Tr;
13496
13501
  exports.UnorderedList = UnorderedList;
13497
- exports.__test_exports__ = __test_exports__;
13498
13502
  exports.checkboxColors = checkboxColors;
13499
13503
  exports.checkboxSizes = checkboxSizes;
13500
13504
  exports.classNames = classNames;