@allxsmith/bestax-bulma 5.1.3 → 5.2.1

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
@@ -1155,6 +1155,18 @@ Pagination.Ellipsis = PaginationEllipsis;
1155
1155
  Pagination.Previous = PaginationPrevious;
1156
1156
  Pagination.Next = PaginationNext;
1157
1157
 
1158
+ function stripRedundantLibraryPrefix(name, library) {
1159
+ if (!name) {
1160
+ return name;
1161
+ }
1162
+ if (library === 'fa' && name.startsWith('fa-')) {
1163
+ return name.substring(3);
1164
+ }
1165
+ if (library === 'mdi' && name.startsWith('mdi-')) {
1166
+ return name.substring(4);
1167
+ }
1168
+ return name;
1169
+ }
1158
1170
  function getIconClasses(library, name, variant, features) {
1159
1171
  let baseClass;
1160
1172
  let iconClass;
@@ -1228,6 +1240,7 @@ const Icon = ({ className, textColor, bgColor, name, library, variant, features,
1228
1240
  }
1229
1241
  const defaultLibrary = useIconLibrary();
1230
1242
  const finalLibrary = library || defaultLibrary || 'fa';
1243
+ finalName = stripRedundantLibraryPrefix(finalName, finalLibrary);
1231
1244
  const { bulmaHelperClasses, rest } = useBulmaClasses({
1232
1245
  color: textColor,
1233
1246
  backgroundColor: bgColor,
@@ -2237,7 +2250,7 @@ const DialogContainer = () => {
2237
2250
  };
2238
2251
 
2239
2252
  const validButtonColors = [...validColors, 'text', 'ghost'];
2240
- const Button = ({ color, size, isLight, isRounded, isLoading, isStatic, isFullWidth, isOutlined, isInverted, isFocused, isActive, isHovered, isDisabled, className, children, textColor, bgColor, as = 'button', href, onClick, target, rel, ...props }) => {
2253
+ const Button = ({ color, size, isLight, isRounded, isLoading, isStatic, isFullWidth, isOutlined, isInverted, isFocused, isActive, isHovered, isDisabled, className, children, textColor, bgColor, as: Component = 'button', href, onClick, target, rel, ...props }) => {
2241
2254
  const { bulmaHelperClasses, rest } = useBulmaClasses({
2242
2255
  color: textColor,
2243
2256
  backgroundColor: bgColor,
@@ -2260,9 +2273,9 @@ const Button = ({ color, size, isLight, isRounded, isLoading, isStatic, isFullWi
2260
2273
  'is-fullwidth': isFullWidth,
2261
2274
  });
2262
2275
  const buttonClasses = classNames(bulmaClasses, bulmaHelperClasses, className);
2263
- if (as === 'a') {
2276
+ if (Component !== 'button') {
2264
2277
  const { type: _type, disabled: _disabled, form: _form, formAction: _formAction, formEncType: _formEncType, formMethod: _formMethod, formNoValidate: _formNoValidate, formTarget: _formTarget, name: _name, value: _value, autoFocus: _autoFocus, ...anchorRest } = rest;
2265
- return (jsx("a", { className: buttonClasses, href: href, target: target, rel: rel, "aria-disabled": isDisabled, tabIndex: isDisabled ? -1 : undefined, onClick: isDisabled
2278
+ return (jsx(Component, { className: buttonClasses, href: href, target: target, rel: rel, "aria-disabled": isDisabled, tabIndex: isDisabled ? -1 : undefined, onClick: isDisabled
2266
2279
  ? (e) => e.preventDefault()
2267
2280
  : onClick, ...anchorRest, children: children }));
2268
2281
  }
@@ -2675,7 +2688,7 @@ const Image = ({ as, className, textColor, bgColor, size, isRounded, isRetina, s
2675
2688
  return (jsx(Tag, { className: imageClasses, ...rest, children: content }));
2676
2689
  };
2677
2690
 
2678
- const Link = ({ className, textColor, bgColor, isActive, children, ...props }) => {
2691
+ const Link = ({ className, textColor, bgColor, isActive, as: Component = 'a', children, ...props }) => {
2679
2692
  const { bulmaHelperClasses, rest } = useBulmaClasses({
2680
2693
  color: textColor,
2681
2694
  backgroundColor: bgColor,
@@ -2685,7 +2698,7 @@ const Link = ({ className, textColor, bgColor, isActive, children, ...props }) =
2685
2698
  'is-active': isActive,
2686
2699
  });
2687
2700
  const linkClasses = classNames(bulmaClasses, bulmaHelperClasses, className);
2688
- return (jsx("a", { className: linkClasses || undefined, ...rest, children: children }));
2701
+ return (jsx(Component, { className: linkClasses || undefined, ...rest, children: children }));
2689
2702
  };
2690
2703
 
2691
2704
  const ListItem = ({ className, textColor, bgColor, children, ...props }) => {