@allxsmith/bestax-bulma 5.16.11 → 5.17.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/index.cjs +129 -73
- package/dist/index.cjs.map +1 -1
- package/dist/index.esm.js +129 -73
- package/dist/index.esm.js.map +1 -1
- package/dist/types/components/Card.d.ts +23 -2
- package/dist/types-cjs/components/Card.d.ts +23 -2
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -1673,6 +1673,75 @@ const Breadcrumb = ({ className, alignment, separator, size, children, ...props
|
|
|
1673
1673
|
return (jsxRuntime.jsx("nav", { className: breadcrumbClasses, "aria-label": "breadcrumbs", ...rest, children: jsxRuntime.jsx("ul", { children: children }) }));
|
|
1674
1674
|
};
|
|
1675
1675
|
|
|
1676
|
+
/**
|
|
1677
|
+
* The runtime mirror of `AnchorOnlyAttributes`, keyed so the two cannot drift.
|
|
1678
|
+
*
|
|
1679
|
+
* `Record<keyof …, true>` is what links them: the day React adds an anchor
|
|
1680
|
+
* attribute, every component deriving its props from `as` accepts it and this
|
|
1681
|
+
* object stops compiling until it is named here. A plain array beside a derived
|
|
1682
|
+
* type drifts in the one direction that matters — the type accepts the new
|
|
1683
|
+
* attribute and the filter lets it leak onto a `<div>`.
|
|
1684
|
+
*/
|
|
1685
|
+
const ANCHOR_ONLY_ATTRS = {
|
|
1686
|
+
href: true,
|
|
1687
|
+
target: true,
|
|
1688
|
+
download: true,
|
|
1689
|
+
hrefLang: true,
|
|
1690
|
+
ping: true,
|
|
1691
|
+
referrerPolicy: true,
|
|
1692
|
+
media: true,
|
|
1693
|
+
type: true,
|
|
1694
|
+
};
|
|
1695
|
+
/**
|
|
1696
|
+
* `props` without the keys named in `strip`.
|
|
1697
|
+
*
|
|
1698
|
+
* The SET is per component and deliberately not shared, because the right
|
|
1699
|
+
* answer differs and the differences are principled: how open the component's
|
|
1700
|
+
* `as` is, and which of these attributes its own tags legitimately take. What
|
|
1701
|
+
* IS shared is the derived source of truth above and this function. Each caller
|
|
1702
|
+
* declares its delta next to the set it passes, which is the only place that
|
|
1703
|
+
* stays true when a component's `as` changes.
|
|
1704
|
+
*/
|
|
1705
|
+
function omitAttrs(props, strip) {
|
|
1706
|
+
const out = {};
|
|
1707
|
+
// `Reflect.ownKeys`, not `Object.entries`: the latter drops symbol-keyed props.
|
|
1708
|
+
// React enumerates props with `for...in`, which never reports a symbol, so
|
|
1709
|
+
// nothing renders differently either way. It is not the same change for all
|
|
1710
|
+
// three callers: Menu filtered by rest-destructure and kept them already,
|
|
1711
|
+
// while Dropdown and Level filtered through `Object.entries` and did not, so
|
|
1712
|
+
// this restores one and widens two. Symbols are the only shape where those
|
|
1713
|
+
// two disagreed, and keeping them is the side a spread is on.
|
|
1714
|
+
for (const key of Reflect.ownKeys(props)) {
|
|
1715
|
+
// Enumerability, for the same reason in the other direction: `Reflect.ownKeys`
|
|
1716
|
+
// also reports NON-enumerable own props, which every filter this replaced left
|
|
1717
|
+
// behind. Copying one out would both add a prop the old code dropped and make
|
|
1718
|
+
// it enumerable on the way, so widening the key source must not widen this.
|
|
1719
|
+
if (!Object.prototype.propertyIsEnumerable.call(props, key))
|
|
1720
|
+
continue;
|
|
1721
|
+
const value = props[key];
|
|
1722
|
+
// `hasOwnProperty`, not `key in strip`: `in` walks the prototype chain, so a
|
|
1723
|
+
// prop named `toString`, `valueOf`, `constructor` or `hasOwnProperty` was
|
|
1724
|
+
// stripped although no caller named it — and anything written to
|
|
1725
|
+
// `Object.prototype` would start deleting props that share its keys.
|
|
1726
|
+
if (typeof key === 'symbol' ||
|
|
1727
|
+
!Object.prototype.hasOwnProperty.call(strip, key)) {
|
|
1728
|
+
// `defineProperty`, not `out[key] = value`: assignment consults the
|
|
1729
|
+
// prototype chain for a setter, and `__proto__` has one. A prop named
|
|
1730
|
+
// `__proto__` would be swallowed by it — dropped from the result AND
|
|
1731
|
+
// replacing the result's prototype with its value. A spread and a rest
|
|
1732
|
+
// destructure both DEFINE, which is what makes them immune, so this has
|
|
1733
|
+
// to define too.
|
|
1734
|
+
Object.defineProperty(out, key, {
|
|
1735
|
+
value,
|
|
1736
|
+
writable: true,
|
|
1737
|
+
enumerable: true,
|
|
1738
|
+
configurable: true,
|
|
1739
|
+
});
|
|
1740
|
+
}
|
|
1741
|
+
}
|
|
1742
|
+
return out;
|
|
1743
|
+
}
|
|
1744
|
+
|
|
1676
1745
|
/**
|
|
1677
1746
|
* Merges helper-emitted inline styles (e.g., `bulmaHelperStyles` from
|
|
1678
1747
|
* `useBulmaClasses`) with a user-supplied `style` prop.
|
|
@@ -1749,6 +1818,34 @@ const CardComponent = ({ className, children, textColor, color, bgColor, hasShad
|
|
|
1749
1818
|
hasCompoundComponents(children) &&
|
|
1750
1819
|
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 })) }))] }));
|
|
1751
1820
|
};
|
|
1821
|
+
/**
|
|
1822
|
+
* The set withheld from a non-anchor `Card.FooterItem` (`span`/`button`): the
|
|
1823
|
+
* derived anchor-only attributes, minus `type` (also valid on a `<button>` as
|
|
1824
|
+
* `submit`/`button`/`reset`, so stripping it there would remove a working
|
|
1825
|
+
* attribute — the same trade `DropdownItem`'s own `STRIP_FROM_NON_ANCHOR`
|
|
1826
|
+
* accepts, in `./Dropdown.tsx`), plus `rel` (React declares it on
|
|
1827
|
+
* `HTMLAttributes` for every element, so the derived set alone would not
|
|
1828
|
+
* withhold it — the same addition `Level.Item` makes).
|
|
1829
|
+
*/
|
|
1830
|
+
const STRIP_FROM_NON_ANCHOR$2 = (() => {
|
|
1831
|
+
const { type: _type, ...rest } = ANCHOR_ONLY_ATTRS;
|
|
1832
|
+
return { ...rest, rel: true };
|
|
1833
|
+
})();
|
|
1834
|
+
/**
|
|
1835
|
+
* The set withheld from a non-button `Card.FooterItem` (`span`/`a`), keyed so
|
|
1836
|
+
* it stops compiling until a button attribute React adds is named here.
|
|
1837
|
+
*/
|
|
1838
|
+
const STRIP_FROM_NON_BUTTON = {
|
|
1839
|
+
disabled: true,
|
|
1840
|
+
form: true,
|
|
1841
|
+
formAction: true,
|
|
1842
|
+
formEncType: true,
|
|
1843
|
+
formMethod: true,
|
|
1844
|
+
formNoValidate: true,
|
|
1845
|
+
formTarget: true,
|
|
1846
|
+
name: true,
|
|
1847
|
+
value: true,
|
|
1848
|
+
};
|
|
1752
1849
|
/**
|
|
1753
1850
|
* Card header compound component. Wraps children in a `.card-header` element.
|
|
1754
1851
|
*
|
|
@@ -1779,13 +1876,14 @@ const CardHeader = ({ className, children, centered, color, bgColor, textColor,
|
|
|
1779
1876
|
* @param {CardHeaderTitleProps} props - Props for the CardHeaderTitle component.
|
|
1780
1877
|
* @returns {JSX.Element} The rendered card header title.
|
|
1781
1878
|
*/
|
|
1782
|
-
const CardHeaderTitle = ({ className, children, centered, color, bgColor, textColor, ...props }) => {
|
|
1879
|
+
const CardHeaderTitle = ({ as = 'div', className, children, centered, color, bgColor, textColor, ...props }) => {
|
|
1783
1880
|
const { bulmaHelperClasses, rest } = useBulmaClasses({
|
|
1784
1881
|
color: textColor ?? color,
|
|
1785
1882
|
backgroundColor: bgColor,
|
|
1786
1883
|
...props,
|
|
1787
1884
|
});
|
|
1788
|
-
|
|
1885
|
+
const Tag = as;
|
|
1886
|
+
return (jsxRuntime.jsx(Tag, { className: classNames(usePrefixedClassNames('card-header-title', {
|
|
1789
1887
|
'is-centered': centered,
|
|
1790
1888
|
}), bulmaHelperClasses, className), ...rest, children: children }));
|
|
1791
1889
|
};
|
|
@@ -1856,13 +1954,40 @@ const CardFooter = ({ className, children, color, bgColor, textColor, ...props }
|
|
|
1856
1954
|
* @param {CardFooterItemProps} props - Props for the CardFooterItem component.
|
|
1857
1955
|
* @returns {JSX.Element} The rendered card footer item.
|
|
1858
1956
|
*/
|
|
1859
|
-
const CardFooterItem = ({ className, children, color, bgColor, textColor, ...props }) => {
|
|
1957
|
+
const CardFooterItem = ({ as = 'span', className, children, color, bgColor, textColor, ...props }) => {
|
|
1860
1958
|
const { bulmaHelperClasses, rest } = useBulmaClasses({
|
|
1861
1959
|
color: textColor ?? color,
|
|
1862
1960
|
backgroundColor: bgColor,
|
|
1863
1961
|
...props,
|
|
1864
1962
|
});
|
|
1865
|
-
|
|
1963
|
+
const itemClasses = classNames(usePrefixedClassNames('card-footer-item'), bulmaHelperClasses, className);
|
|
1964
|
+
// The anchor's own attributes reach an `<a>` and nothing else, and the button's a
|
|
1965
|
+
// `<button>` — `STRIP_FROM_NON_ANCHOR` above names the anchor set and why `type`
|
|
1966
|
+
// stays while `rel` is added, and `STRIP_FROM_NON_BUTTON` the button set.
|
|
1967
|
+
if (as === 'a') {
|
|
1968
|
+
return (jsxRuntime.jsx("a", { className: itemClasses, ...omitAttrs(rest, STRIP_FROM_NON_BUTTON), children: children }));
|
|
1969
|
+
}
|
|
1970
|
+
const forwarded = omitAttrs(rest, STRIP_FROM_NON_ANCHOR$2);
|
|
1971
|
+
if (as === 'button') {
|
|
1972
|
+
const forwardedType = forwarded.type;
|
|
1973
|
+
return (jsxRuntime.jsx("button", { className: itemClasses, ...forwarded,
|
|
1974
|
+
// A footer item button must not submit an enclosing form by default —
|
|
1975
|
+
// `<button>` defaults to `type="submit"`, and a Save/Cancel action row
|
|
1976
|
+
// sitting in a form is the common case this `as` exists for.
|
|
1977
|
+
//
|
|
1978
|
+
// A MISSING `type` is not the only way that default arrives: `type` is
|
|
1979
|
+
// typed here as the `<a>` MIME string (`STRIP_FROM_NON_ANCHOR` above
|
|
1980
|
+
// says why it is not withheld), so `as="button" type="text/html"`
|
|
1981
|
+
// compiles, and HTML's INVALID-value default for a button's `type` is
|
|
1982
|
+
// submit too. So anything that is not one of the three native button
|
|
1983
|
+
// types falls back to `button` rather than being forwarded.
|
|
1984
|
+
type: forwardedType === 'submit' ||
|
|
1985
|
+
forwardedType === 'reset' ||
|
|
1986
|
+
forwardedType === 'button'
|
|
1987
|
+
? forwardedType
|
|
1988
|
+
: 'button', children: children }));
|
|
1989
|
+
}
|
|
1990
|
+
return (jsxRuntime.jsx("span", { className: itemClasses, ...omitAttrs(forwarded, STRIP_FROM_NON_BUTTON), children: children }));
|
|
1866
1991
|
};
|
|
1867
1992
|
// Attach nested Title and Icon components to CardHeader
|
|
1868
1993
|
const CardHeaderCompound = withSubComponents(CardHeader, {
|
|
@@ -1878,75 +2003,6 @@ const Card = withSubComponents(CardComponent, {
|
|
|
1878
2003
|
FooterItem: CardFooterItem,
|
|
1879
2004
|
}, 'Card');
|
|
1880
2005
|
|
|
1881
|
-
/**
|
|
1882
|
-
* The runtime mirror of `AnchorOnlyAttributes`, keyed so the two cannot drift.
|
|
1883
|
-
*
|
|
1884
|
-
* `Record<keyof …, true>` is what links them: the day React adds an anchor
|
|
1885
|
-
* attribute, every component deriving its props from `as` accepts it and this
|
|
1886
|
-
* object stops compiling until it is named here. A plain array beside a derived
|
|
1887
|
-
* type drifts in the one direction that matters — the type accepts the new
|
|
1888
|
-
* attribute and the filter lets it leak onto a `<div>`.
|
|
1889
|
-
*/
|
|
1890
|
-
const ANCHOR_ONLY_ATTRS = {
|
|
1891
|
-
href: true,
|
|
1892
|
-
target: true,
|
|
1893
|
-
download: true,
|
|
1894
|
-
hrefLang: true,
|
|
1895
|
-
ping: true,
|
|
1896
|
-
referrerPolicy: true,
|
|
1897
|
-
media: true,
|
|
1898
|
-
type: true,
|
|
1899
|
-
};
|
|
1900
|
-
/**
|
|
1901
|
-
* `props` without the keys named in `strip`.
|
|
1902
|
-
*
|
|
1903
|
-
* The SET is per component and deliberately not shared, because the right
|
|
1904
|
-
* answer differs and the differences are principled: how open the component's
|
|
1905
|
-
* `as` is, and which of these attributes its own tags legitimately take. What
|
|
1906
|
-
* IS shared is the derived source of truth above and this function. Each caller
|
|
1907
|
-
* declares its delta next to the set it passes, which is the only place that
|
|
1908
|
-
* stays true when a component's `as` changes.
|
|
1909
|
-
*/
|
|
1910
|
-
function omitAttrs(props, strip) {
|
|
1911
|
-
const out = {};
|
|
1912
|
-
// `Reflect.ownKeys`, not `Object.entries`: the latter drops symbol-keyed props.
|
|
1913
|
-
// React enumerates props with `for...in`, which never reports a symbol, so
|
|
1914
|
-
// nothing renders differently either way. It is not the same change for all
|
|
1915
|
-
// three callers: Menu filtered by rest-destructure and kept them already,
|
|
1916
|
-
// while Dropdown and Level filtered through `Object.entries` and did not, so
|
|
1917
|
-
// this restores one and widens two. Symbols are the only shape where those
|
|
1918
|
-
// two disagreed, and keeping them is the side a spread is on.
|
|
1919
|
-
for (const key of Reflect.ownKeys(props)) {
|
|
1920
|
-
// Enumerability, for the same reason in the other direction: `Reflect.ownKeys`
|
|
1921
|
-
// also reports NON-enumerable own props, which every filter this replaced left
|
|
1922
|
-
// behind. Copying one out would both add a prop the old code dropped and make
|
|
1923
|
-
// it enumerable on the way, so widening the key source must not widen this.
|
|
1924
|
-
if (!Object.prototype.propertyIsEnumerable.call(props, key))
|
|
1925
|
-
continue;
|
|
1926
|
-
const value = props[key];
|
|
1927
|
-
// `hasOwnProperty`, not `key in strip`: `in` walks the prototype chain, so a
|
|
1928
|
-
// prop named `toString`, `valueOf`, `constructor` or `hasOwnProperty` was
|
|
1929
|
-
// stripped although no caller named it — and anything written to
|
|
1930
|
-
// `Object.prototype` would start deleting props that share its keys.
|
|
1931
|
-
if (typeof key === 'symbol' ||
|
|
1932
|
-
!Object.prototype.hasOwnProperty.call(strip, key)) {
|
|
1933
|
-
// `defineProperty`, not `out[key] = value`: assignment consults the
|
|
1934
|
-
// prototype chain for a setter, and `__proto__` has one. A prop named
|
|
1935
|
-
// `__proto__` would be swallowed by it — dropped from the result AND
|
|
1936
|
-
// replacing the result's prototype with its value. A spread and a rest
|
|
1937
|
-
// destructure both DEFINE, which is what makes them immune, so this has
|
|
1938
|
-
// to define too.
|
|
1939
|
-
Object.defineProperty(out, key, {
|
|
1940
|
-
value,
|
|
1941
|
-
writable: true,
|
|
1942
|
-
enumerable: true,
|
|
1943
|
-
configurable: true,
|
|
1944
|
-
});
|
|
1945
|
-
}
|
|
1946
|
-
}
|
|
1947
|
-
return out;
|
|
1948
|
-
}
|
|
1949
|
-
|
|
1950
2006
|
/**
|
|
1951
2007
|
* Checks if code is running in a browser environment.
|
|
1952
2008
|
* @deprecated Dropdown's internal SSR guard, exported by accident; it will
|