@pixpilot/shadcn-ui 0.52.1 → 0.53.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/Button.cjs CHANGED
@@ -21,6 +21,14 @@ function getLoaderSize(size) {
21
21
  if (size === "lg" || size === "icon-lg") return LOADER_SIZE_LG;
22
22
  return LOADER_SIZE_DEFAULT;
23
23
  }
24
+ /**
25
+ * Render tooltip content. If it's a string containing newlines, split into
26
+ * paragraphs; otherwise render the node as-is.
27
+ */
28
+ async function renderTooltipContent(content) {
29
+ if (typeof content === "string") return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_jsx_runtime.Fragment, { children: content.split("\n").map((line, i) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", { children: line }, i)) });
30
+ return content;
31
+ }
24
32
  function Button(props) {
25
33
  const { children, disabled, onClick, disabledTooltip, loading, loaderProps, onDisabledClick, tooltip, title, tooltipProps, className, variant, size, ref,...rest } = props;
26
34
  const { placement: loaderPlacement = "end" } = loaderProps || {};
@@ -31,10 +39,11 @@ function Button(props) {
31
39
  const hasTooltip = Boolean(tooltip);
32
40
  const hasDisabledTooltip = Boolean(disabledTooltip) && isDisabled;
33
41
  const showTooltip = hasTooltip || hasDisabledTooltip;
34
- const tooltipContent = hasDisabledTooltip ? disabledTooltip ?? "" : tooltip ?? "";
42
+ const tooltipContent = hasDisabledTooltip ? disabledTooltip : tooltip;
43
+ const hasArea = variant !== "ghost" && variant !== "link";
35
44
  const Loader = /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
36
45
  "data-slot": "button-loader",
37
- className: (0, __pixpilot_shadcn.cn)("flex items-center justify-center", loaderPlacement === "center" && "rounded-0 absolute inset-0", loaderPlacement === "start" && "mr-1", loaderPlacement === "end" && "ml-1"),
46
+ className: (0, __pixpilot_shadcn.cn)("flex items-center justify-center", loaderPlacement === "center" && "rounded-0 absolute inset-0", hasArea && loaderPlacement === "start" && "mr-1", hasArea && loaderPlacement === "end" && "ml-1"),
38
47
  children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(lucide_react.Loader2, {
39
48
  className: "animate-spin",
40
49
  style: {
@@ -64,7 +73,7 @@ function Button(props) {
64
73
  cursor: "not-allowed"
65
74
  }
66
75
  })
67
- }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(__pixpilot_shadcn.TooltipContent, { children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", { children: disabledTooltip }) })]
76
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(__pixpilot_shadcn.TooltipContent, { children: renderTooltipContent(disabledTooltip) })]
68
77
  }),
69
78
  loading && loaderPlacement === "start" && Loader,
70
79
  children,
@@ -76,7 +85,7 @@ function Button(props) {
76
85
  children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(__pixpilot_shadcn.TooltipTrigger, {
77
86
  asChild: true,
78
87
  children: buttonContent
79
- }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(__pixpilot_shadcn.TooltipContent, { children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", { children: tooltipContent }) })]
88
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(__pixpilot_shadcn.TooltipContent, { children: renderTooltipContent(tooltipContent) })]
80
89
  });
81
90
  return buttonContent;
82
91
  }
package/dist/Button.d.cts CHANGED
@@ -15,11 +15,11 @@ interface ButtonProps extends React.ComponentProps<typeof Button>, VariantProps<
15
15
  /**
16
16
  * Tooltip message to show when button is disabled
17
17
  */
18
- disabledTooltip?: string;
18
+ disabledTooltip?: React.ReactNode;
19
19
  /**
20
20
  * Regular tooltip message
21
21
  */
22
- tooltip?: string;
22
+ tooltip?: React.ReactNode;
23
23
  /**
24
24
  * Loading state
25
25
  */
package/dist/Button.d.ts CHANGED
@@ -15,11 +15,11 @@ interface ButtonProps extends React.ComponentProps<typeof Button>, VariantProps<
15
15
  /**
16
16
  * Tooltip message to show when button is disabled
17
17
  */
18
- disabledTooltip?: string;
18
+ disabledTooltip?: React.ReactNode;
19
19
  /**
20
20
  * Regular tooltip message
21
21
  */
22
- tooltip?: string;
22
+ tooltip?: React.ReactNode;
23
23
  /**
24
24
  * Loading state
25
25
  */
package/dist/Button.js CHANGED
@@ -2,7 +2,7 @@ import { AbsoluteFill } from "./AbsoluteFill.js";
2
2
  import { Button, Tooltip, TooltipContent, TooltipTrigger, cn } from "@pixpilot/shadcn";
3
3
  import { Loader2 } from "lucide-react";
4
4
  import React, { useCallback } from "react";
5
- import { jsx, jsxs } from "react/jsx-runtime";
5
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
6
6
 
7
7
  //#region src/Button.tsx
8
8
  const LOADER_SIZE_SM = 14;
@@ -16,6 +16,14 @@ function getLoaderSize(size) {
16
16
  if (size === "lg" || size === "icon-lg") return LOADER_SIZE_LG;
17
17
  return LOADER_SIZE_DEFAULT;
18
18
  }
19
+ /**
20
+ * Render tooltip content. If it's a string containing newlines, split into
21
+ * paragraphs; otherwise render the node as-is.
22
+ */
23
+ async function renderTooltipContent(content) {
24
+ if (typeof content === "string") return /* @__PURE__ */ jsx(Fragment, { children: content.split("\n").map((line, i) => /* @__PURE__ */ jsx("p", { children: line }, i)) });
25
+ return content;
26
+ }
19
27
  function Button$1(props) {
20
28
  const { children, disabled, onClick, disabledTooltip, loading, loaderProps, onDisabledClick, tooltip, title, tooltipProps, className, variant, size, ref,...rest } = props;
21
29
  const { placement: loaderPlacement = "end" } = loaderProps || {};
@@ -26,10 +34,11 @@ function Button$1(props) {
26
34
  const hasTooltip = Boolean(tooltip);
27
35
  const hasDisabledTooltip = Boolean(disabledTooltip) && isDisabled;
28
36
  const showTooltip = hasTooltip || hasDisabledTooltip;
29
- const tooltipContent = hasDisabledTooltip ? disabledTooltip ?? "" : tooltip ?? "";
37
+ const tooltipContent = hasDisabledTooltip ? disabledTooltip : tooltip;
38
+ const hasArea = variant !== "ghost" && variant !== "link";
30
39
  const Loader = /* @__PURE__ */ jsx("div", {
31
40
  "data-slot": "button-loader",
32
- className: cn("flex items-center justify-center", loaderPlacement === "center" && "rounded-0 absolute inset-0", loaderPlacement === "start" && "mr-1", loaderPlacement === "end" && "ml-1"),
41
+ className: cn("flex items-center justify-center", loaderPlacement === "center" && "rounded-0 absolute inset-0", hasArea && loaderPlacement === "start" && "mr-1", hasArea && loaderPlacement === "end" && "ml-1"),
33
42
  children: /* @__PURE__ */ jsx(Loader2, {
34
43
  className: "animate-spin",
35
44
  style: {
@@ -59,7 +68,7 @@ function Button$1(props) {
59
68
  cursor: "not-allowed"
60
69
  }
61
70
  })
62
- }), /* @__PURE__ */ jsx(TooltipContent, { children: /* @__PURE__ */ jsx("p", { children: disabledTooltip }) })]
71
+ }), /* @__PURE__ */ jsx(TooltipContent, { children: renderTooltipContent(disabledTooltip) })]
63
72
  }),
64
73
  loading && loaderPlacement === "start" && Loader,
65
74
  children,
@@ -71,7 +80,7 @@ function Button$1(props) {
71
80
  children: [/* @__PURE__ */ jsx(TooltipTrigger, {
72
81
  asChild: true,
73
82
  children: buttonContent
74
- }), /* @__PURE__ */ jsx(TooltipContent, { children: /* @__PURE__ */ jsx("p", { children: tooltipContent }) })]
83
+ }), /* @__PURE__ */ jsx(TooltipContent, { children: renderTooltipContent(tooltipContent) })]
75
84
  });
76
85
  return buttonContent;
77
86
  }
@@ -1,10 +1,10 @@
1
1
  import { FileUploadInlineProps } from "./types.js";
2
- import * as react_jsx_runtime11 from "react/jsx-runtime";
2
+ import * as react_jsx_runtime12 from "react/jsx-runtime";
3
3
 
4
4
  //#region src/file-upload-inline/FileUploadInline.d.ts
5
5
  /**
6
6
  * FileUploadInline - An inline file upload component using FileUpload primitives
7
7
  */
8
- declare function FileUploadInline(props: FileUploadInlineProps): react_jsx_runtime11.JSX.Element;
8
+ declare function FileUploadInline(props: FileUploadInlineProps): react_jsx_runtime12.JSX.Element;
9
9
  //#endregion
10
10
  export { FileUploadInline };
@@ -1,6 +1,6 @@
1
1
  import { InputProps } from "@pixpilot/shadcn";
2
2
  import * as React$1 from "react";
3
- import * as react_jsx_runtime12 from "react/jsx-runtime";
3
+ import * as react_jsx_runtime11 from "react/jsx-runtime";
4
4
 
5
5
  //#region src/input/Input.d.ts
6
6
  type InputProps$1 = InputProps & {
@@ -10,6 +10,6 @@ type InputProps$1 = InputProps & {
10
10
  prefixClassName?: string;
11
11
  suffixClassName?: string;
12
12
  };
13
- declare function Input$1(props: InputProps$1): react_jsx_runtime12.JSX.Element;
13
+ declare function Input$1(props: InputProps$1): react_jsx_runtime11.JSX.Element;
14
14
  //#endregion
15
15
  export { Input$1 as Input, InputProps$1 as InputProps };
@@ -1,4 +1,4 @@
1
- import * as react_jsx_runtime16 from "react/jsx-runtime";
1
+ import * as react_jsx_runtime17 from "react/jsx-runtime";
2
2
 
3
3
  //#region src/theme-toggle/ThemeModeDropdown.d.ts
4
4
  interface ThemeModeDropdownProps {
@@ -17,7 +17,7 @@ interface ThemeModeDropdownProps {
17
17
  * Provides Light / Dark / System options.
18
18
  * Pure component - requires themeValue and onChange props.
19
19
  */
20
- declare function ThemeModeDropdown(props: ThemeModeDropdownProps): react_jsx_runtime16.JSX.Element;
20
+ declare function ThemeModeDropdown(props: ThemeModeDropdownProps): react_jsx_runtime17.JSX.Element;
21
21
  declare namespace ThemeModeDropdown {
22
22
  var displayName: string;
23
23
  }
@@ -1,4 +1,4 @@
1
- import * as react_jsx_runtime16 from "react/jsx-runtime";
1
+ import * as react_jsx_runtime17 from "react/jsx-runtime";
2
2
 
3
3
  //#region src/theme-toggle/ThemeModeDropdown.d.ts
4
4
  interface ThemeModeDropdownProps {
@@ -17,7 +17,7 @@ interface ThemeModeDropdownProps {
17
17
  * Provides Light / Dark / System options.
18
18
  * Pure component - requires themeValue and onChange props.
19
19
  */
20
- declare function ThemeModeDropdown(props: ThemeModeDropdownProps): react_jsx_runtime16.JSX.Element;
20
+ declare function ThemeModeDropdown(props: ThemeModeDropdownProps): react_jsx_runtime17.JSX.Element;
21
21
  declare namespace ThemeModeDropdown {
22
22
  var displayName: string;
23
23
  }
@@ -1,4 +1,4 @@
1
- import * as react_jsx_runtime17 from "react/jsx-runtime";
1
+ import * as react_jsx_runtime16 from "react/jsx-runtime";
2
2
 
3
3
  //#region src/theme-toggle/ThemeModeSwitchInside.d.ts
4
4
  type ThemeModeSwitchInsideSize = 'sm' | 'md' | 'lg';
@@ -25,7 +25,7 @@ interface ThemeModeSwitchInsideProps {
25
25
  * Icons are embedded within the switch control.
26
26
  * Pure component - requires value and onChange props.
27
27
  */
28
- declare function ThemeModeSwitchInside(props: ThemeModeSwitchInsideProps): react_jsx_runtime17.JSX.Element;
28
+ declare function ThemeModeSwitchInside(props: ThemeModeSwitchInsideProps): react_jsx_runtime16.JSX.Element;
29
29
  declare namespace ThemeModeSwitchInside {
30
30
  var displayName: string;
31
31
  }
@@ -1,4 +1,4 @@
1
- import * as react_jsx_runtime15 from "react/jsx-runtime";
1
+ import * as react_jsx_runtime18 from "react/jsx-runtime";
2
2
 
3
3
  //#region src/theme-toggle/ThemeModeSwitchInside.d.ts
4
4
  type ThemeModeSwitchInsideSize = 'sm' | 'md' | 'lg';
@@ -25,7 +25,7 @@ interface ThemeModeSwitchInsideProps {
25
25
  * Icons are embedded within the switch control.
26
26
  * Pure component - requires value and onChange props.
27
27
  */
28
- declare function ThemeModeSwitchInside(props: ThemeModeSwitchInsideProps): react_jsx_runtime15.JSX.Element;
28
+ declare function ThemeModeSwitchInside(props: ThemeModeSwitchInsideProps): react_jsx_runtime18.JSX.Element;
29
29
  declare namespace ThemeModeSwitchInside {
30
30
  var displayName: string;
31
31
  }
@@ -1,4 +1,4 @@
1
- import * as react_jsx_runtime18 from "react/jsx-runtime";
1
+ import * as react_jsx_runtime16 from "react/jsx-runtime";
2
2
 
3
3
  //#region src/theme-toggle/ThemeModeSwitchOutside.d.ts
4
4
  interface ThemeModeSwitchOutsideProps {
@@ -22,7 +22,7 @@ interface ThemeModeSwitchOutsideProps {
22
22
  * Icons flank the switch control on either side.
23
23
  * Pure component - requires value and onChange props.
24
24
  */
25
- declare function ThemeModeSwitchOutside(props: ThemeModeSwitchOutsideProps): react_jsx_runtime18.JSX.Element;
25
+ declare function ThemeModeSwitchOutside(props: ThemeModeSwitchOutsideProps): react_jsx_runtime16.JSX.Element;
26
26
  declare namespace ThemeModeSwitchOutside {
27
27
  var displayName: string;
28
28
  }
@@ -1,4 +1,4 @@
1
- import * as react_jsx_runtime17 from "react/jsx-runtime";
1
+ import * as react_jsx_runtime15 from "react/jsx-runtime";
2
2
 
3
3
  //#region src/theme-toggle/ThemeModeToggleButton.d.ts
4
4
  interface ThemeModeToggleButtonProps {
@@ -13,7 +13,7 @@ interface ThemeModeToggleButtonProps {
13
13
  * Light/Dark toggle button.
14
14
  * Pure component - toggles between light and dark.
15
15
  */
16
- declare function ThemeModeToggleButton(props: ThemeModeToggleButtonProps): react_jsx_runtime17.JSX.Element;
16
+ declare function ThemeModeToggleButton(props: ThemeModeToggleButtonProps): react_jsx_runtime15.JSX.Element;
17
17
  declare namespace ThemeModeToggleButton {
18
18
  var displayName: string;
19
19
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@pixpilot/shadcn-ui",
3
3
  "type": "module",
4
- "version": "0.52.1",
4
+ "version": "0.53.0",
5
5
  "description": "Custom UI components and utilities built with shadcn/ui.",
6
6
  "author": "m.doaie <m.doaie@hotmail.com>",
7
7
  "license": "MIT",
@@ -60,9 +60,9 @@
60
60
  "react-dom": "19.2.0",
61
61
  "tsdown": "^0.15.12",
62
62
  "typescript": "^5.9.3",
63
- "@internal/eslint-config": "0.3.0",
64
63
  "@internal/hooks": "0.0.0",
65
64
  "@internal/prettier-config": "0.0.1",
65
+ "@internal/eslint-config": "0.3.0",
66
66
  "@internal/tsconfig": "0.1.0",
67
67
  "@internal/tsdown-config": "0.1.0",
68
68
  "@internal/vitest-config": "0.1.0"