@allxsmith/bestax-bulma 5.13.0 → 5.14.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.
@@ -1,6 +1,6 @@
1
1
  import React from 'react';
2
2
  import { BulmaClassesProps } from '../helpers/useBulmaClasses';
3
- import { IconProps } from '../elements/Icon';
3
+ import { IconChildrenProps, IconNameProps } from '../elements/Icon';
4
4
  /**
5
5
  * Props for the Panel component.
6
6
  */
@@ -45,7 +45,7 @@ export interface PanelBlockProps extends React.AnchorHTMLAttributes<HTMLAnchorEl
45
45
  * Props for the PanelIcon component.
46
46
  * Extends IconProps but uses 'panel-icon' as the container class.
47
47
  */
48
- export type PanelIconProps = Omit<IconProps, 'containerClassName'>;
48
+ export type PanelIconProps = Omit<IconNameProps, 'containerClassName'> | Omit<IconChildrenProps, 'containerClassName'>;
49
49
  /**
50
50
  * Props for the PanelInputBlock component.
51
51
  */
@@ -102,8 +102,9 @@ export declare const PanelTabs: React.FC<PanelTabsProps>;
102
102
  */
103
103
  export declare const PanelBlock: React.FC<PanelBlockProps>;
104
104
  /**
105
- * Icon wrapper with panel styling (renders as `<span class="panel-icon"><i/></span>`).
106
- * Accepts all Icon props (`name`, `variant`, `features`, etc.)
105
+ * Icon wrapper with panel styling (renders as `<span class="panel-icon">`, containing an
106
+ * `<i/>` when a `name` is given, or the custom node passed as `children`).
107
+ * Accepts all Icon props (`name`, `variant`, `features`, etc.), or `children` for a custom node.
107
108
  *
108
109
  * @function
109
110
  * @param {PanelIconProps} props - Props for the PanelIcon component.
@@ -21,9 +21,10 @@ declare module 'react' {
21
21
  }
22
22
  type IconLibrary = 'fa' | 'mdi' | 'ion' | 'material-icons' | 'material-symbols';
23
23
  /**
24
- * Props for the Icon component.
24
+ * Shared props for the Icon component, independent of whether a class-based `name` or a
25
+ * custom `children` node supplies the glyph.
25
26
  */
26
- export interface IconProps extends React.HTMLAttributes<HTMLSpanElement>, BulmaClassesProps {
27
+ interface IconBaseProps extends React.HTMLAttributes<HTMLSpanElement>, BulmaClassesProps {
27
28
  /** Additional CSS classes to apply. */
28
29
  className?: string;
29
30
  /** Text color helper. */
@@ -32,18 +33,16 @@ export interface IconProps extends React.HTMLAttributes<HTMLSpanElement>, BulmaC
32
33
  color?: 'primary' | 'link' | 'info' | 'success' | 'warning' | 'danger';
33
34
  /** Background color helper. */
34
35
  bgColor?: (typeof validColors)[number] | 'inherit' | 'current';
35
- /** The icon name, with or without its library prefix (e.g. `'star'` or `'fa-star'`). */
36
- name: string;
37
36
  /** DEPRECATED: Legacy prop, use `name` instead. */
38
37
  icon?: string;
39
38
  /**
40
- * The icon library to use ('fa' = Font Awesome, 'mdi' = Material Design Icons, 'ion' = Ionicons Web Components, 'material-icons' = Google Material Icons, 'material-symbols' = Google Material Symbols). Defaults to the value set in ConfigProvider or 'fa' if not configured.
39
+ * The icon library to use ('fa' = Font Awesome, 'mdi' = Material Design Icons, 'ion' = Ionicons Web Components, 'material-icons' = Google Material Icons, 'material-symbols' = Google Material Symbols). Defaults to the value set in ConfigProvider or 'fa' if not configured. Ignored when `children` supplies the glyph instead of `name`.
41
40
  * @defaultValue 'fa'
42
41
  */
43
42
  library?: IconLibrary;
44
- /** Icon style variant (e.g. `'solid'`, `'outlined'`, `'rounded'`). */
43
+ /** Icon style variant (e.g. `'solid'`, `'outlined'`, `'rounded'`). Ignored when `children` supplies the glyph instead of `name`. */
45
44
  variant?: string;
46
- /** Additional modifiers (e.g. `'fa-lg'`, `'fa-spin'`, `'is-size-1'`). */
45
+ /** Additional modifiers (e.g. `'fa-lg'`, `'fa-spin'`, `'is-size-1'`). Ignored when `children` supplies the glyph instead of `name`. */
47
46
  features?: string | string[];
48
47
  /** **DEPRECATED:** Use `variant` and `features` instead. */
49
48
  libraryFeatures?: string | string[];
@@ -64,6 +63,30 @@ export interface IconProps extends React.HTMLAttributes<HTMLSpanElement>, BulmaC
64
63
  /** Override the default `'icon'` container class (e.g., `'panel-icon'`). */
65
64
  containerClassName?: string;
66
65
  }
66
+ /**
67
+ * Props for `Icon` rendering a class-based glyph from an icon library.
68
+ */
69
+ export interface IconNameProps extends IconBaseProps {
70
+ /** The icon name, with or without its library prefix (e.g. `'star'` or `'fa-star'`). Mutually exclusive with `children`. */
71
+ name: string;
72
+ /** A custom node (an inline SVG, a `react-icons` component, …) rendered inside the icon container in place of a class-based glyph. Mutually exclusive with `name`. */
73
+ children?: never;
74
+ }
75
+ /**
76
+ * Props for `Icon` rendering a custom node (an inline SVG, a `react-icons` component, a Font
77
+ * Awesome React `<FontAwesomeIcon>`, …) in place of a class-based glyph.
78
+ */
79
+ export interface IconChildrenProps extends IconBaseProps {
80
+ /** The icon name, with or without its library prefix (e.g. `'star'` or `'fa-star'`). Mutually exclusive with `children`. */
81
+ name?: undefined;
82
+ /** A custom node (an inline SVG, a `react-icons` component, …) rendered inside the icon container in place of a class-based glyph. Mutually exclusive with `name`. */
83
+ children: Exclude<React.ReactNode, undefined>;
84
+ }
85
+ /**
86
+ * Props for the Icon component — a discriminated union of a class-based `name` and a custom
87
+ * `children` node.
88
+ */
89
+ export type IconProps = IconNameProps | IconChildrenProps;
67
90
  /**
68
91
  * The `Icon` component is a Bulma-styled wrapper for displaying icons from various libraries (Font Awesome, Material Design Icons, Ionicons, Google Material Icons, Material Symbols, etc.).
69
92
  *
@@ -5,8 +5,8 @@ import { IconProps } from './Icon';
5
5
  * Represents an item for the IconText component, containing icon props and optional text.
6
6
  */
7
7
  interface IconTextItem {
8
- /** Props for the Icon component. */
9
- iconProps: IconProps;
8
+ /** Props for the Icon component, or a custom node (an inline SVG, a `react-icons` component, …) rendered in place of a class-based glyph. */
9
+ iconProps: IconProps | React.ReactNode;
10
10
  /** Optional text to display next to the icon. */
11
11
  text?: string;
12
12
  }
@@ -27,8 +27,8 @@ interface IconTextProps extends React.HTMLAttributes<HTMLSpanElement>, BulmaClas
27
27
  color?: 'primary' | 'link' | 'info' | 'success' | 'warning' | 'danger';
28
28
  /** Background color helper. */
29
29
  bgColor?: (typeof validColors)[number] | 'inherit' | 'current';
30
- /** Props for a single Icon component (for single icon mode). */
31
- iconProps?: IconProps;
30
+ /** Props for a single Icon component, or a custom node, for single icon mode. */
31
+ iconProps?: IconProps | React.ReactNode;
32
32
  /** Text for a single icon (for single icon mode). */
33
33
  children?: React.ReactNode;
34
34
  /** Array of icon/text pairs (for multiple icons mode). */
@@ -21,10 +21,10 @@ export interface ControlBaseProps extends React.HTMLAttributes<HTMLDivElement>,
21
21
  color?: 'primary' | 'link' | 'info' | 'success' | 'warning' | 'danger';
22
22
  /** Background color. */
23
23
  bgColor?: (typeof validColors)[number] | 'inherit' | 'current';
24
- /** Icon props for left icon. */
25
- iconLeft?: IconProps;
26
- /** Icon props for right icon. */
27
- iconRight?: IconProps;
24
+ /** Icon props for left icon, or a custom node (an inline SVG, a `react-icons` component, …) rendered in place of a class-based glyph. */
25
+ iconLeft?: IconProps | React.ReactNode;
26
+ /** Icon props for right icon, or a custom node (an inline SVG, a `react-icons` component, …) rendered in place of a class-based glyph. */
27
+ iconRight?: IconProps | React.ReactNode;
28
28
  /** Shortcut for left icon name. */
29
29
  iconLeftName?: string;
30
30
  /** Shortcut for left icon size. */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@allxsmith/bestax-bulma",
3
- "version": "5.13.0",
3
+ "version": "5.14.0",
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",