@allxsmith/bestax-bulma 5.15.2 → 5.15.3

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.js CHANGED
@@ -12996,7 +12996,7 @@ const LevelRight = ({ className, children, color, bgColor, textColor, ...props }
12996
12996
  * @param {LevelItemProps} props - Props for the LevelItem component.
12997
12997
  * @returns {JSX.Element} The rendered level item.
12998
12998
  */
12999
- const LevelItem = ({ as = 'div', hasTextCentered, className, children, href, target, rel, color, bgColor, textColor, ...props }) => {
12999
+ const LevelItem = ({ as = 'div', hasTextCentered, className, children, color, bgColor, textColor, ...props }) => {
13000
13000
  const { bulmaHelperClasses, rest } = useBulmaClasses({
13001
13001
  color: textColor ?? color,
13002
13002
  backgroundColor: bgColor,
@@ -13007,11 +13007,37 @@ const LevelItem = ({ as = 'div', hasTextCentered, className, children, href, tar
13007
13007
  'has-text-centered': hasTextCentered,
13008
13008
  });
13009
13009
  const levelItemClasses = classNames(mainClass, bulmaHelperClasses, className);
13010
- // If rendering as "a", only pass anchor-specific props
13010
+ // The anchor's own attributes reach an `<a>` and nothing else. The type
13011
+ // declares them at every `as` — narrowing that is source-breaking (#672) — so
13012
+ // the runtime is what keeps `<Level.Item as="p" download>` from rendering a
13013
+ // dead attribute.
13014
+ //
13015
+ // Keyed off `AnchorOnlyAttributes` rather than repeated as a list, because a
13016
+ // hand list beside a derived type drifts in the one direction that matters:
13017
+ // the day React adds an anchor attribute, the type would accept it at every
13018
+ // `as` while the list let it leak onto a `<div>`. `Record` makes that a
13019
+ // compile error here until this object catches up. #682 is the issue for
13020
+ // sharing the rule with the two components that keep their own copies.
13021
+ const ANCHOR_ONLY = {
13022
+ href: true,
13023
+ target: true,
13024
+ download: true,
13025
+ hrefLang: true,
13026
+ ping: true,
13027
+ referrerPolicy: true,
13028
+ media: true,
13029
+ type: true,
13030
+ // `rel` is NOT in the subtraction: React declares it on `HTMLAttributes`,
13031
+ // for every element. It is here because this component has always withheld
13032
+ // it from a non-anchor, and it is named separately so the key set above
13033
+ // stays honest about where each name comes from.
13034
+ rel: true,
13035
+ };
13011
13036
  if (Tag === 'a') {
13012
- return (jsxRuntime.jsx("a", { className: levelItemClasses, href: href, target: target, rel: rel, ...rest, children: children }));
13037
+ return (jsxRuntime.jsx("a", { className: levelItemClasses, ...rest, children: children }));
13013
13038
  }
13014
- return (jsxRuntime.jsx(Tag, { className: levelItemClasses, ...rest, children: children }));
13039
+ const withoutAnchorAttrs = Object.fromEntries(Object.entries(rest).filter(([key]) => !(key in ANCHOR_ONLY)));
13040
+ return (jsxRuntime.jsx(Tag, { className: levelItemClasses, ...withoutAnchorAttrs, children: children }));
13015
13041
  };
13016
13042
  const Level = withSubComponents(LevelComponent, {
13017
13043
  Left: LevelLeft,