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