@almadar/ui 5.80.0 → 5.82.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,5 +1,6 @@
1
1
  import React from "react";
2
2
  import { type IconInput } from "./Icon";
3
+ import type { Asset } from "@almadar/core";
3
4
  export type BadgeVariant = "default" | "primary" | "secondary" | "success" | "warning" | "danger" | "error" | "info" | "neutral";
4
5
  export type BadgeSize = "sm" | "md" | "lg";
5
6
  export interface BadgeProps extends React.HTMLAttributes<HTMLSpanElement> {
@@ -15,6 +16,8 @@ export interface BadgeProps extends React.HTMLAttributes<HTMLSpanElement> {
15
16
  label?: string | number;
16
17
  /** Lucide icon component or canonical kebab-case icon name string */
17
18
  icon?: IconInput;
19
+ /** Asset image rendered as the badge icon; takes precedence over icon when provided. */
20
+ iconAsset?: Asset;
18
21
  /** When set, renders a small X button on the right of the badge that
19
22
  * invokes this handler — turns the badge into a removable chip.
20
23
  * Used by the TagInput molecule and other "list of removable values"
@@ -1,5 +1,5 @@
1
1
  import React from "react";
2
- import type { EventKey, EventPayload } from "@almadar/core";
2
+ import type { Asset, EventKey, EventPayload } from "@almadar/core";
3
3
  import { type IconInput } from "./Icon";
4
4
  export type ButtonVariant = "primary" | "secondary" | "ghost" | "danger" | "success" | "warning" | "default";
5
5
  export type ButtonSize = "sm" | "md" | "lg";
@@ -17,6 +17,8 @@ export interface ButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElemen
17
17
  icon?: IconInput;
18
18
  /** Alias for rightIcon */
19
19
  iconRight?: IconInput;
20
+ /** Asset image rendered as the leading icon; takes precedence over icon/leftIcon when provided. */
21
+ iconAsset?: Asset;
20
22
  /** Declarative event name — emits UI:{action} via eventBus on click */
21
23
  action?: EventKey;
22
24
  /** Payload to include with the action event */
@@ -5,7 +5,7 @@
5
5
  * Uses theme-aware CSS variables for styling.
6
6
  */
7
7
  import React from 'react';
8
- import type { EventEmit } from '@almadar/core';
8
+ import type { Asset, EventEmit } from '@almadar/core';
9
9
  import type { IconInput } from '../atoms/index';
10
10
  export interface TabItem {
11
11
  /**
@@ -24,6 +24,8 @@ export interface TabItem {
24
24
  content?: React.ReactNode;
25
25
  /** Tab icon — pass either a Lucide component or its registry name (e.g. "file-text") */
26
26
  icon?: IconInput;
27
+ /** Asset image rendered as the tab icon; takes precedence over icon when provided. */
28
+ iconAsset?: Asset;
27
29
  /** Tab badge */
28
30
  badge?: string | number;
29
31
  /** Disable tab */
@@ -5,6 +5,8 @@ export interface GameCardProps {
5
5
  cost?: number;
6
6
  /** Card art asset */
7
7
  art?: Asset;
8
+ /** Asset rendered as the card border/frame via backgroundImage; falls back to CSS border styling when absent. */
9
+ frameAsset?: Asset;
8
10
  attack?: number;
9
11
  defense?: number;
10
12
  name?: string;
@@ -20,7 +22,7 @@ export interface GameCardProps {
20
22
  }>;
21
23
  className?: string;
22
24
  }
23
- export declare function GameCard({ id, cost, art, attack, defense, name, selected, disabled, size, onClick, clickEvent, className, }: GameCardProps): React.JSX.Element;
25
+ export declare function GameCard({ id, cost, art, frameAsset, attack, defense, name, selected, disabled, size, onClick, clickEvent, className, }: GameCardProps): React.JSX.Element;
24
26
  export declare namespace GameCard {
25
27
  var displayName: string;
26
28
  }
@@ -3196,6 +3196,7 @@ var Button = React6__default.default.forwardRef(
3196
3196
  rightIcon,
3197
3197
  icon: iconProp,
3198
3198
  iconRight: iconRightProp,
3199
+ iconAsset,
3199
3200
  action,
3200
3201
  actionPayload,
3201
3202
  label,
@@ -3207,7 +3208,8 @@ var Button = React6__default.default.forwardRef(
3207
3208
  const eventBus = useEventBus();
3208
3209
  const leftIconValue = leftIcon || iconProp;
3209
3210
  const rightIconValue = rightIcon || iconRightProp;
3210
- const resolvedLeftIcon = resolveIconProp(leftIconValue, iconSizeStyles[size]);
3211
+ const px = size === "sm" ? 16 : size === "lg" ? 20 : 16;
3212
+ const resolvedLeftIcon = iconAsset?.url ? /* @__PURE__ */ jsxRuntime.jsx("img", { src: iconAsset.url, alt: iconAsset.name ?? iconAsset.category ?? "", width: px, height: px, style: { imageRendering: "pixelated", objectFit: "contain", width: px, height: px }, className: "flex-shrink-0" }) : resolveIconProp(leftIconValue, iconSizeStyles[size]);
3211
3213
  const resolvedRightIcon = resolveIconProp(rightIconValue, iconSizeStyles[size]);
3212
3214
  const handleClick = (e) => {
3213
3215
  if (action) {
@@ -3172,6 +3172,7 @@ var Button = React6.forwardRef(
3172
3172
  rightIcon,
3173
3173
  icon: iconProp,
3174
3174
  iconRight: iconRightProp,
3175
+ iconAsset,
3175
3176
  action,
3176
3177
  actionPayload,
3177
3178
  label,
@@ -3183,7 +3184,8 @@ var Button = React6.forwardRef(
3183
3184
  const eventBus = useEventBus();
3184
3185
  const leftIconValue = leftIcon || iconProp;
3185
3186
  const rightIconValue = rightIcon || iconRightProp;
3186
- const resolvedLeftIcon = resolveIconProp(leftIconValue, iconSizeStyles[size]);
3187
+ const px = size === "sm" ? 16 : size === "lg" ? 20 : 16;
3188
+ const resolvedLeftIcon = iconAsset?.url ? /* @__PURE__ */ jsx("img", { src: iconAsset.url, alt: iconAsset.name ?? iconAsset.category ?? "", width: px, height: px, style: { imageRendering: "pixelated", objectFit: "contain", width: px, height: px }, className: "flex-shrink-0" }) : resolveIconProp(leftIconValue, iconSizeStyles[size]);
3187
3189
  const resolvedRightIcon = resolveIconProp(rightIconValue, iconSizeStyles[size]);
3188
3190
  const handleClick = (e) => {
3189
3191
  if (action) {