@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.
@@ -64,10 +64,40 @@ export interface LevelRightProps extends React.HTMLAttributes<HTMLDivElement>, O
64
64
  * @returns {JSX.Element} The rendered level right section.
65
65
  */
66
66
  export declare const LevelRight: React.FC<LevelRightProps>;
67
+ /**
68
+ * Exactly what `<a>` adds over the attributes every element has: `href`,
69
+ * `target`, `download`, `hrefLang`, `ping`, `referrerPolicy`, `media`, `type`.
70
+ *
71
+ * NOT `rel`, which React declares on `HTMLAttributes` for every element and the
72
+ * subtraction therefore removes. This component withholds it from a non-anchor
73
+ * anyway, because it always has — see `ANCHOR_ONLY` in the implementation,
74
+ * where it is named separately for that reason.
75
+ *
76
+ * Subtracted from React's own types rather than listed. Listing them is how this
77
+ * component came to reject `download` at `as="a"` — the list said `href`,
78
+ * `target`, `rel` and stopped, and #641 is the report. A list gains an entry only
79
+ * when someone notices; a subtraction gains it when React does.
80
+ *
81
+ * They reach the `<a>` branch and no other: declared at every `as` because
82
+ * narrowing them to the anchor is source-breaking (#672, `next-major`), and
83
+ * withheld at runtime so the type's permissiveness costs no dead markup.
84
+ */
85
+ type AnchorOnlyAttributes = Omit<React.AnchorHTMLAttributes<HTMLAnchorElement>, keyof React.HTMLAttributes<HTMLAnchorElement>>;
67
86
  /**
68
87
  * Props for the LevelItem component.
88
+ *
89
+ * The anchor attributes are enumerated here, at every `as`, and forwarded only
90
+ * when the tag is an `<a>` — so `<Level.Item as="p" download>` compiles and
91
+ * renders a `<p>` without it. That asymmetry is deliberate for now: deriving
92
+ * them from `as` instead is what makes the dead pair a type error, and it also
93
+ * stops `const p: LevelItemProps = { href }` compiling for consumers who write
94
+ * it today. #672 carries that half, labelled `next-major`.
95
+ *
96
+ * What this list must NOT become is a shorter one. Enumerating only `href`,
97
+ * `target` and `rel` made every other anchor attribute a type error even at
98
+ * `as="a"`, which is what #641 reported.
69
99
  */
70
- export interface LevelItemProps extends React.HTMLAttributes<HTMLDivElement | HTMLParagraphElement | HTMLAnchorElement>, Omit<BulmaClassesProps, 'color' | 'backgroundColor'> {
100
+ export interface LevelItemProps extends AnchorOnlyAttributes, React.HTMLAttributes<HTMLDivElement | HTMLParagraphElement | HTMLAnchorElement>, Omit<BulmaClassesProps, 'color' | 'backgroundColor'> {
71
101
  /** Element type to render. */
72
102
  as?: 'div' | 'p' | 'a';
73
103
  /** Center the text in the item. */
@@ -82,12 +112,6 @@ export interface LevelItemProps extends React.HTMLAttributes<HTMLDivElement | HT
82
112
  className?: string;
83
113
  /** Content. */
84
114
  children?: React.ReactNode;
85
- /** Href for "a" tag. */
86
- href?: string;
87
- /** Target for "a" tag */
88
- target?: string;
89
- /** Rel for "a" tag */
90
- rel?: string;
91
115
  }
92
116
  /**
93
117
  * Individual item, can be rendered as `div`, `p`, or `a`.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@allxsmith/bestax-bulma",
3
- "version": "5.15.2",
3
+ "version": "5.15.3",
4
4
  "description": "A fully-typed React component library for the Bulma CSS framework. Build modern UIs quickly with reusable, accessible, and customizable Bulma-based React components.",
5
5
  "main": "dist/index.cjs.js",
6
6
  "module": "dist/index.esm.js",