@hexclave/dashboard-ui-components 1.0.61 → 1.0.63

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.
@@ -6,7 +6,8 @@ type DesignBadgeContentMode = "both" | "text" | "icon";
6
6
  type DesignBadgeProps = {
7
7
  label: string;
8
8
  color: DesignBadgeColor;
9
- icon?: React.ElementType;
9
+ icon?: React.ElementType; /** Extra classes merged onto the rendered icon, e.g. `animate-spin` for an in-progress status. */
10
+ iconClassName?: string;
10
11
  size?: DesignBadgeSize; /** What to display: "both" (default), "text" (label only), or "icon" (icon only; requires icon prop). */
11
12
  contentMode?: DesignBadgeContentMode;
12
13
  };
@@ -30,6 +31,7 @@ declare function DesignBadge({
30
31
  label,
31
32
  color,
32
33
  icon,
34
+ iconClassName,
33
35
  size,
34
36
  contentMode
35
37
  }: DesignBadgeProps): import("react/jsx-runtime").JSX.Element;
@@ -1 +1 @@
1
- {"version":3,"file":"badge.d.ts","names":[],"sources":["../../src/components/badge.tsx"],"mappings":";KAIY,gBAAA;AAAA,KACA,eAAA;;KAoBA,sBAAA;AAAA,KAEA,gBAAA;EACV,KAAA;EACA,KAAA,EAAO,gBAAA;EACP,IAAA,GAAO,KAAA,CAAM,WAAA;EACb,IAAA,GAAO,eAAA,EA1BkB;EA4BzB,WAAA,GAAc,sBAAA;AAAA;;;;AARkB;AAElC;;;;;;;;;;;;iBAiDgB,WAAA;EACd,KAAA;EACA,KAAA;EACA,IAAA;EACA,IAAA;EACA;AAAA,GACC,gBAAA,+BAAgB,GAAA,CAAA,OAAA"}
1
+ {"version":3,"file":"badge.d.ts","names":[],"sources":["../../src/components/badge.tsx"],"mappings":";KAIY,gBAAA;AAAA,KACA,eAAA;;KAoBA,sBAAA;AAAA,KAEA,gBAAA;EACV,KAAA;EACA,KAAA,EAAO,gBAAA;EACP,IAAA,GAAO,KAAA,CAAM,WAAA;EAEb,aAAA;EACA,IAAA,GAAO,eAAA,EARG;EAUV,WAAA,GAAc,sBAAA;AAAA;;AAVkB;AAElC;;;;;;;;;;;;;;iBAmDgB,WAAA;EACd,KAAA;EACA,KAAA;EACA,IAAA;EACA,aAAA;EACA,IAAA;EACA;AAAA,GACC,gBAAA,+BAAgB,GAAA,CAAA,OAAA"}
@@ -51,7 +51,7 @@ function getShowLabelShowIcon(contentMode, hasIcon) {
51
51
  * - `color` is one of: `"blue" | "cyan" | "purple" | "green" | "orange" | "red"`.
52
52
  * - `icon` is optional but, if set via `contentMode: "icon"`, is required.
53
53
  */
54
- function DesignBadge({ label, color, icon, size = "md", contentMode = "both" }) {
54
+ function DesignBadge({ label, color, icon, iconClassName, size = "md", contentMode = "both" }) {
55
55
  const Icon = icon;
56
56
  const { showLabel, showIcon } = getShowLabelShowIcon(contentMode, !!Icon);
57
57
  if (!showLabel && !showIcon) throw new Error("DesignBadge must show at least label or icon.");
@@ -60,7 +60,7 @@ function DesignBadge({ label, color, icon, size = "md", contentMode = "both" })
60
60
  className: (0, _hexclave_ui.cn)("inline-flex max-w-full items-center gap-1.5 whitespace-nowrap rounded-full font-medium leading-none", getMapValueOrThrow(badgeStyles, color, "badgeStyles"), sizeClasses),
61
61
  title: !showLabel ? label : void 0,
62
62
  "aria-label": label,
63
- children: [showIcon && Icon && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Icon, { className: "h-3 w-3" }), showLabel ? label : null]
63
+ children: [showIcon && Icon && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Icon, { className: (0, _hexclave_ui.cn)("h-3 w-3", iconClassName) }), showLabel ? label : null]
64
64
  });
65
65
  }
66
66
  //#endregion
@@ -1 +1 @@
1
- {"version":3,"file":"badge.js","names":["_exhaustive"],"sources":["../../src/components/badge.tsx"],"sourcesContent":["\"use client\";\n\nimport { cn } from \"@hexclave/ui\";\n\nexport type DesignBadgeColor = \"blue\" | \"cyan\" | \"purple\" | \"green\" | \"orange\" | \"red\";\nexport type DesignBadgeSize = \"sm\" | \"md\";\n\nconst badgeStyles = new Map<DesignBadgeColor, string>([\n [\"blue\", \"text-blue-700 dark:text-blue-400 bg-blue-500/20 dark:bg-blue-500/10 ring-1 ring-blue-500/30 dark:ring-blue-500/20\"],\n [\"cyan\", \"text-cyan-700 dark:text-cyan-400 bg-cyan-500/20 dark:bg-cyan-500/10 ring-1 ring-cyan-500/30 dark:ring-cyan-500/20\"],\n [\"purple\", \"text-purple-700 dark:text-purple-400 bg-purple-500/20 dark:bg-purple-500/10 ring-1 ring-purple-500/30 dark:ring-purple-500/20\"],\n [\"green\", \"text-emerald-700 dark:text-emerald-400 bg-emerald-500/20 dark:bg-emerald-500/10 ring-1 ring-emerald-500/30 dark:ring-emerald-500/20\"],\n [\"orange\", \"text-amber-700 dark:text-amber-300 bg-amber-500/20 dark:bg-amber-500/10 ring-1 ring-amber-500/30 dark:ring-amber-500/20\"],\n [\"red\", \"text-red-700 dark:text-red-400 bg-red-500/20 dark:bg-red-500/10 ring-1 ring-red-500/30 dark:ring-red-500/20\"],\n]);\n\nfunction getMapValueOrThrow<TKey, TValue>(map: Map<TKey, TValue>, key: TKey, mapName: string) {\n const value = map.get(key);\n if (!value) {\n throw new Error(`Missing ${mapName} entry for key \"${String(key)}\"`);\n }\n return value;\n}\n\n/** At least one of showLabel or showIcon must be true. */\nexport type DesignBadgeContentMode = \"both\" | \"text\" | \"icon\";\n\nexport type DesignBadgeProps = {\n label: string,\n color: DesignBadgeColor,\n icon?: React.ElementType,\n size?: DesignBadgeSize,\n /** What to display: \"both\" (default), \"text\" (label only), or \"icon\" (icon only; requires icon prop). */\n contentMode?: DesignBadgeContentMode,\n};\n\nfunction getShowLabelShowIcon(\n contentMode: DesignBadgeContentMode,\n hasIcon: boolean,\n): { showLabel: boolean, showIcon: boolean } {\n switch (contentMode) {\n case \"both\": {\n return { showLabel: true, showIcon: hasIcon };\n }\n case \"text\": {\n return { showLabel: true, showIcon: false };\n }\n case \"icon\": {\n if (!hasIcon) {\n throw new Error(\"DesignBadge contentMode 'icon' requires the icon prop to be provided.\");\n }\n return { showLabel: false, showIcon: true };\n }\n default: {\n const _exhaustive: never = contentMode;\n throw new Error(`Unknown contentMode: ${String(_exhaustive)}`);\n }\n }\n}\n\n/**\n * Small pill used for status tags, roles, categories, and other short\n * labels. Not a variant-based component — pick a semantic `color` and\n * optionally pass an `icon` (as a component type, not a rendered node).\n *\n * ```tsx\n * <DesignBadge label=\"Verified\" color=\"green\" icon={CheckIcon} />\n * <DesignBadge label=\"Beta\" color=\"purple\" />\n * <DesignBadge label=\"Error\" color=\"red\" size=\"sm\" />\n * ```\n *\n * Notes:\n * - Props are `label` + `color`, NOT `variant` + children.\n * - `color` is one of: `\"blue\" | \"cyan\" | \"purple\" | \"green\" | \"orange\" | \"red\"`.\n * - `icon` is optional but, if set via `contentMode: \"icon\"`, is required.\n */\nexport function DesignBadge({\n label,\n color,\n icon,\n size = \"md\",\n contentMode = \"both\",\n}: DesignBadgeProps) {\n const Icon = icon;\n const { showLabel, showIcon } = getShowLabelShowIcon(contentMode, !!Icon);\n if (!showLabel && !showIcon) {\n throw new Error(\"DesignBadge must show at least label or icon.\");\n }\n const sizeClasses = size === \"sm\"\n ? \"px-2 py-0.5 text-[10px]\"\n : \"px-2.5 py-1 text-[11px]\";\n const colorClasses = getMapValueOrThrow(badgeStyles, color, \"badgeStyles\");\n\n return (\n <div\n className={cn(\n \"inline-flex max-w-full items-center gap-1.5 whitespace-nowrap rounded-full font-medium leading-none\",\n colorClasses,\n sizeClasses\n )}\n title={!showLabel ? label : undefined}\n aria-label={label}\n >\n {showIcon && Icon && <Icon className=\"h-3 w-3\" />}\n {showLabel ? label : null}\n </div>\n );\n}\n"],"mappings":";;;;;AAOA,MAAM,8BAAc,IAAI,IAA8B;CACpD,CAAC,QAAQ,mHAAmH;CAC5H,CAAC,QAAQ,mHAAmH;CAC5H,CAAC,UAAU,+HAA+H;CAC1I,CAAC,SAAS,qIAAqI;CAC/I,CAAC,UAAU,yHAAyH;CACpI,CAAC,OAAO,6GAA6G;AACvH,CAAC;AAED,SAAS,mBAAiC,KAAwB,KAAW,SAAiB;CAC5F,MAAM,QAAQ,IAAI,IAAI,GAAG;CACzB,IAAI,CAAC,OACH,MAAM,IAAI,MAAM,WAAW,QAAQ,kBAAkB,OAAO,GAAG,EAAE,EAAE;CAErE,OAAO;AACT;AAcA,SAAS,qBACP,aACA,SAC2C;CAC3C,QAAQ,aAAR;EACE,KAAK,QACH,OAAO;GAAE,WAAW;GAAM,UAAU;EAAQ;EAE9C,KAAK,QACH,OAAO;GAAE,WAAW;GAAM,UAAU;EAAM;EAE5C,KAAK;GACH,IAAI,CAAC,SACH,MAAM,IAAI,MAAM,uEAAuE;GAEzF,OAAO;IAAE,WAAW;IAAO,UAAU;GAAK;EAE5C,SAEE,MAAM,IAAI,MAAM,wBAAwB,OAAOA,WAAW,GAAG;CAEjE;AACF;;;;;;;;;;;;;;;;;AAkBA,SAAgB,YAAY,EAC1B,OACA,OACA,MACA,OAAO,MACP,cAAc,UACK;CACnB,MAAM,OAAO;CACb,MAAM,EAAE,WAAW,aAAa,qBAAqB,aAAa,CAAC,CAAC,IAAI;CACxE,IAAI,CAAC,aAAa,CAAC,UACjB,MAAM,IAAI,MAAM,+CAA+C;CAEjE,MAAM,cAAc,SAAS,OACzB,4BACA;CAGJ,OACE,iBAAA,GAAA,kBAAA,KAAA,CAAC,OAAD;EACE,YAAA,GAAA,aAAA,GAAA,CACE,uGALe,mBAAmB,aAAa,OAAO,aAM3C,GACX,WACF;EACA,OAAO,CAAC,YAAY,QAAQ,KAAA;EAC5B,cAAY;YAPd,CASG,YAAY,QAAQ,iBAAA,GAAA,kBAAA,IAAA,CAAC,MAAD,EAAM,WAAU,UAAW,CAAA,GAC/C,YAAY,QAAQ,IAClB;;AAET"}
1
+ {"version":3,"file":"badge.js","names":["_exhaustive"],"sources":["../../src/components/badge.tsx"],"sourcesContent":["\"use client\";\n\nimport { cn } from \"@hexclave/ui\";\n\nexport type DesignBadgeColor = \"blue\" | \"cyan\" | \"purple\" | \"green\" | \"orange\" | \"red\";\nexport type DesignBadgeSize = \"sm\" | \"md\";\n\nconst badgeStyles = new Map<DesignBadgeColor, string>([\n [\"blue\", \"text-blue-700 dark:text-blue-400 bg-blue-500/20 dark:bg-blue-500/10 ring-1 ring-blue-500/30 dark:ring-blue-500/20\"],\n [\"cyan\", \"text-cyan-700 dark:text-cyan-400 bg-cyan-500/20 dark:bg-cyan-500/10 ring-1 ring-cyan-500/30 dark:ring-cyan-500/20\"],\n [\"purple\", \"text-purple-700 dark:text-purple-400 bg-purple-500/20 dark:bg-purple-500/10 ring-1 ring-purple-500/30 dark:ring-purple-500/20\"],\n [\"green\", \"text-emerald-700 dark:text-emerald-400 bg-emerald-500/20 dark:bg-emerald-500/10 ring-1 ring-emerald-500/30 dark:ring-emerald-500/20\"],\n [\"orange\", \"text-amber-700 dark:text-amber-300 bg-amber-500/20 dark:bg-amber-500/10 ring-1 ring-amber-500/30 dark:ring-amber-500/20\"],\n [\"red\", \"text-red-700 dark:text-red-400 bg-red-500/20 dark:bg-red-500/10 ring-1 ring-red-500/30 dark:ring-red-500/20\"],\n]);\n\nfunction getMapValueOrThrow<TKey, TValue>(map: Map<TKey, TValue>, key: TKey, mapName: string) {\n const value = map.get(key);\n if (!value) {\n throw new Error(`Missing ${mapName} entry for key \"${String(key)}\"`);\n }\n return value;\n}\n\n/** At least one of showLabel or showIcon must be true. */\nexport type DesignBadgeContentMode = \"both\" | \"text\" | \"icon\";\n\nexport type DesignBadgeProps = {\n label: string,\n color: DesignBadgeColor,\n icon?: React.ElementType,\n /** Extra classes merged onto the rendered icon, e.g. `animate-spin` for an in-progress status. */\n iconClassName?: string,\n size?: DesignBadgeSize,\n /** What to display: \"both\" (default), \"text\" (label only), or \"icon\" (icon only; requires icon prop). */\n contentMode?: DesignBadgeContentMode,\n};\n\nfunction getShowLabelShowIcon(\n contentMode: DesignBadgeContentMode,\n hasIcon: boolean,\n): { showLabel: boolean, showIcon: boolean } {\n switch (contentMode) {\n case \"both\": {\n return { showLabel: true, showIcon: hasIcon };\n }\n case \"text\": {\n return { showLabel: true, showIcon: false };\n }\n case \"icon\": {\n if (!hasIcon) {\n throw new Error(\"DesignBadge contentMode 'icon' requires the icon prop to be provided.\");\n }\n return { showLabel: false, showIcon: true };\n }\n default: {\n const _exhaustive: never = contentMode;\n throw new Error(`Unknown contentMode: ${String(_exhaustive)}`);\n }\n }\n}\n\n/**\n * Small pill used for status tags, roles, categories, and other short\n * labels. Not a variant-based component — pick a semantic `color` and\n * optionally pass an `icon` (as a component type, not a rendered node).\n *\n * ```tsx\n * <DesignBadge label=\"Verified\" color=\"green\" icon={CheckIcon} />\n * <DesignBadge label=\"Beta\" color=\"purple\" />\n * <DesignBadge label=\"Error\" color=\"red\" size=\"sm\" />\n * ```\n *\n * Notes:\n * - Props are `label` + `color`, NOT `variant` + children.\n * - `color` is one of: `\"blue\" | \"cyan\" | \"purple\" | \"green\" | \"orange\" | \"red\"`.\n * - `icon` is optional but, if set via `contentMode: \"icon\"`, is required.\n */\nexport function DesignBadge({\n label,\n color,\n icon,\n iconClassName,\n size = \"md\",\n contentMode = \"both\",\n}: DesignBadgeProps) {\n const Icon = icon;\n const { showLabel, showIcon } = getShowLabelShowIcon(contentMode, !!Icon);\n if (!showLabel && !showIcon) {\n throw new Error(\"DesignBadge must show at least label or icon.\");\n }\n const sizeClasses = size === \"sm\"\n ? \"px-2 py-0.5 text-[10px]\"\n : \"px-2.5 py-1 text-[11px]\";\n const colorClasses = getMapValueOrThrow(badgeStyles, color, \"badgeStyles\");\n\n return (\n <div\n className={cn(\n \"inline-flex max-w-full items-center gap-1.5 whitespace-nowrap rounded-full font-medium leading-none\",\n colorClasses,\n sizeClasses\n )}\n title={!showLabel ? label : undefined}\n aria-label={label}\n >\n {showIcon && Icon && <Icon className={cn(\"h-3 w-3\", iconClassName)} />}\n {showLabel ? label : null}\n </div>\n );\n}\n"],"mappings":";;;;;AAOA,MAAM,8BAAc,IAAI,IAA8B;CACpD,CAAC,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AAa,EAAI,CAAA,GACpE,YAAY,QAAQ,IAClB;;AAET"}
@@ -3,7 +3,7 @@ import { VariantProps } from "class-variance-authority";
3
3
 
4
4
  //#region src/components/button.d.ts
5
5
  declare const designButtonVariants: (props?: ({
6
- variant?: "default" | "destructive" | "outline" | "secondary" | "ghost" | "link" | "plain" | null | undefined;
6
+ variant?: "plain" | "link" | "default" | "destructive" | "outline" | "secondary" | "ghost" | null | undefined;
7
7
  size?: "default" | "sm" | "lg" | "icon" | null | undefined;
8
8
  } & import("class-variance-authority/types").ClassProp) | undefined) => string;
9
9
  type DesignOriginalButtonProps = {
@@ -35,7 +35,7 @@ declare const DesignButton: React.FC<{
35
35
  } & {
36
36
  asChild?: boolean;
37
37
  } & React.ButtonHTMLAttributes<HTMLButtonElement> & VariantProps<(props?: ({
38
- variant?: "default" | "destructive" | "outline" | "secondary" | "ghost" | "link" | "plain" | null | undefined;
38
+ variant?: "plain" | "link" | "default" | "destructive" | "outline" | "secondary" | "ghost" | null | undefined;
39
39
  size?: "default" | "sm" | "lg" | "icon" | null | undefined;
40
40
  } & import("class-variance-authority/types").ClassProp) | undefined) => string> & {
41
41
  ref?: React.Ref<HTMLButtonElement> | undefined;
@@ -34562,6 +34562,7 @@ Defaulting to \`null\`.`;
34562
34562
  label,
34563
34563
  color,
34564
34564
  icon,
34565
+ iconClassName,
34565
34566
  size: size4 = "md",
34566
34567
  contentMode = "both"
34567
34568
  }) {
@@ -34583,7 +34584,7 @@ Defaulting to \`null\`.`;
34583
34584
  title: !showLabel ? label : void 0,
34584
34585
  "aria-label": label,
34585
34586
  children: [
34586
- showIcon && Icon3 && /* @__PURE__ */ jsx(Icon3, { className: "h-3 w-3" }),
34587
+ showIcon && Icon3 && /* @__PURE__ */ jsx(Icon3, { className: cn("h-3 w-3", iconClassName) }),
34587
34588
  showLabel ? label : null
34588
34589
  ]
34589
34590
  }