@algenium/blocks 1.0.1 → 1.1.0-rc.2

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.d.cts CHANGED
@@ -118,10 +118,16 @@ type ThemeSwitcherProps = {
118
118
  align?: "start" | "center" | "end";
119
119
  /** Dropdown side (for mini variant) */
120
120
  side?: "top" | "bottom" | "left" | "right";
121
+ /** Tooltip position relative to the mini trigger (mini variant only) */
122
+ tooltipSide?: "top" | "right" | "bottom" | "left";
123
+ /** Tooltip alignment (mini variant only) */
124
+ tooltipAlign?: "start" | "center" | "end";
125
+ /** Tooltip offset from the trigger in px (mini variant only) */
126
+ tooltipSideOffset?: number;
121
127
  /** Translation labels - consumers can pass their own t() values */
122
128
  labels?: ThemeSwitcherLabels;
123
129
  };
124
- declare function ThemeSwitcher({ className, size, shape, variant, align, side, labels: userLabels, }: ThemeSwitcherProps): react_jsx_runtime.JSX.Element;
130
+ declare function ThemeSwitcher({ className, size, shape, variant, align, side, tooltipSide, tooltipAlign, tooltipSideOffset, labels: userLabels, }: ThemeSwitcherProps): react_jsx_runtime.JSX.Element;
125
131
 
126
132
  type Language = {
127
133
  /** Language key/code (e.g., "en", "es") */
@@ -171,8 +177,14 @@ type LanguageSwitcherProps = {
171
177
  align?: "start" | "center" | "end";
172
178
  /** Dropdown side */
173
179
  side?: "top" | "bottom" | "left" | "right";
180
+ /** Tooltip position relative to the mini trigger (mini variant only) */
181
+ tooltipSide?: "top" | "right" | "bottom" | "left";
182
+ /** Tooltip alignment (mini variant only) */
183
+ tooltipAlign?: "start" | "center" | "end";
184
+ /** Tooltip offset from the trigger in px (mini variant only) */
185
+ tooltipSideOffset?: number;
174
186
  };
175
- declare function LanguageSwitcher({ languages: propLanguages, currentLanguage: propCurrentLanguage, onLanguageChange: propOnLanguageChange, labels, className, size, shape, variant, showIcon, align, side, }: LanguageSwitcherProps): react_jsx_runtime.JSX.Element;
187
+ declare function LanguageSwitcher({ languages: propLanguages, currentLanguage: propCurrentLanguage, onLanguageChange: propOnLanguageChange, labels, className, size, shape, variant, showIcon, align, side, tooltipSide, tooltipAlign, tooltipSideOffset, }: LanguageSwitcherProps): react_jsx_runtime.JSX.Element;
176
188
 
177
189
  interface AvatarEditorProps {
178
190
  /** Current cropped image as data URL (controlled) */
package/dist/index.d.ts CHANGED
@@ -118,10 +118,16 @@ type ThemeSwitcherProps = {
118
118
  align?: "start" | "center" | "end";
119
119
  /** Dropdown side (for mini variant) */
120
120
  side?: "top" | "bottom" | "left" | "right";
121
+ /** Tooltip position relative to the mini trigger (mini variant only) */
122
+ tooltipSide?: "top" | "right" | "bottom" | "left";
123
+ /** Tooltip alignment (mini variant only) */
124
+ tooltipAlign?: "start" | "center" | "end";
125
+ /** Tooltip offset from the trigger in px (mini variant only) */
126
+ tooltipSideOffset?: number;
121
127
  /** Translation labels - consumers can pass their own t() values */
122
128
  labels?: ThemeSwitcherLabels;
123
129
  };
124
- declare function ThemeSwitcher({ className, size, shape, variant, align, side, labels: userLabels, }: ThemeSwitcherProps): react_jsx_runtime.JSX.Element;
130
+ declare function ThemeSwitcher({ className, size, shape, variant, align, side, tooltipSide, tooltipAlign, tooltipSideOffset, labels: userLabels, }: ThemeSwitcherProps): react_jsx_runtime.JSX.Element;
125
131
 
126
132
  type Language = {
127
133
  /** Language key/code (e.g., "en", "es") */
@@ -171,8 +177,14 @@ type LanguageSwitcherProps = {
171
177
  align?: "start" | "center" | "end";
172
178
  /** Dropdown side */
173
179
  side?: "top" | "bottom" | "left" | "right";
180
+ /** Tooltip position relative to the mini trigger (mini variant only) */
181
+ tooltipSide?: "top" | "right" | "bottom" | "left";
182
+ /** Tooltip alignment (mini variant only) */
183
+ tooltipAlign?: "start" | "center" | "end";
184
+ /** Tooltip offset from the trigger in px (mini variant only) */
185
+ tooltipSideOffset?: number;
174
186
  };
175
- declare function LanguageSwitcher({ languages: propLanguages, currentLanguage: propCurrentLanguage, onLanguageChange: propOnLanguageChange, labels, className, size, shape, variant, showIcon, align, side, }: LanguageSwitcherProps): react_jsx_runtime.JSX.Element;
187
+ declare function LanguageSwitcher({ languages: propLanguages, currentLanguage: propCurrentLanguage, onLanguageChange: propOnLanguageChange, labels, className, size, shape, variant, showIcon, align, side, tooltipSide, tooltipAlign, tooltipSideOffset, }: LanguageSwitcherProps): react_jsx_runtime.JSX.Element;
176
188
 
177
189
  interface AvatarEditorProps {
178
190
  /** Current cropped image as data URL (controlled) */
package/dist/index.js CHANGED
@@ -3440,6 +3440,9 @@ function ThemeSwitcher({
3440
3440
  variant = "default",
3441
3441
  align = "center",
3442
3442
  side = "top",
3443
+ tooltipSide = "bottom",
3444
+ tooltipAlign = "center",
3445
+ tooltipSideOffset = 8,
3443
3446
  labels: userLabels
3444
3447
  }) {
3445
3448
  const { theme, setTheme } = useTheme();
@@ -3484,7 +3487,15 @@ function ThemeSwitcher({
3484
3487
  children: /* @__PURE__ */ jsx(CurrentIcon, { className: sizes.iconMini })
3485
3488
  }
3486
3489
  ) }) }),
3487
- /* @__PURE__ */ jsx(TooltipContent, { side: "right", sideOffset: 8, children: labels.theme })
3490
+ /* @__PURE__ */ jsx(
3491
+ TooltipContent,
3492
+ {
3493
+ side: tooltipSide,
3494
+ align: tooltipAlign,
3495
+ sideOffset: tooltipSideOffset,
3496
+ children: labels.theme
3497
+ }
3498
+ )
3488
3499
  ] }),
3489
3500
  /* @__PURE__ */ jsx(DropdownMenuContent, { side, align, sideOffset: 8, children: themes.map(({ key, icon: Icon }) => /* @__PURE__ */ jsxs(
3490
3501
  DropdownMenuItem,
@@ -3595,7 +3606,10 @@ function LanguageSwitcher({
3595
3606
  variant = "default",
3596
3607
  showIcon = true,
3597
3608
  align = "center",
3598
- side = "top"
3609
+ side = "top",
3610
+ tooltipSide = "bottom",
3611
+ tooltipAlign = "center",
3612
+ tooltipSideOffset = 8
3599
3613
  }) {
3600
3614
  const context = useLanguageContext();
3601
3615
  const contextLanguages = context?.languages?.map((lang) => ({
@@ -3623,7 +3637,15 @@ function LanguageSwitcher({
3623
3637
  children: /* @__PURE__ */ jsx(Languages, { className: sizes.iconMini })
3624
3638
  }
3625
3639
  ) }) }),
3626
- /* @__PURE__ */ jsx(TooltipContent, { side: "right", sideOffset: 8, children: defaultLabels2.language })
3640
+ /* @__PURE__ */ jsx(
3641
+ TooltipContent,
3642
+ {
3643
+ side: tooltipSide,
3644
+ align: tooltipAlign,
3645
+ sideOffset: tooltipSideOffset,
3646
+ children: defaultLabels2.language
3647
+ }
3648
+ )
3627
3649
  ] }),
3628
3650
  /* @__PURE__ */ jsx(
3629
3651
  DropdownMenuContent,
@@ -4569,6 +4591,7 @@ function AvatarEditorDialog({
4569
4591
  const [isSaving, setIsSaving] = useState(false);
4570
4592
  const [feedback, setFeedback] = useState(null);
4571
4593
  const isMobile = useMediaQuery("(max-width: 640px)");
4594
+ const caption = (placeholder ?? "").trim();
4572
4595
  const handleOpenChange = useCallback(
4573
4596
  (open) => {
4574
4597
  if (open) {
@@ -4628,10 +4651,25 @@ function AvatarEditorDialog({
4628
4651
  alt: "Avatar",
4629
4652
  className: "w-full h-full object-cover"
4630
4653
  }
4631
- ) : /* @__PURE__ */ jsxs("div", { className: "flex flex-col items-center justify-center text-muted-foreground gap-1", children: [
4632
- /* @__PURE__ */ jsx(User, { className: "w-1/3 h-1/3" }),
4633
- /* @__PURE__ */ jsx("span", { className: "text-xs", children: placeholder })
4634
- ] })
4654
+ ) : /* @__PURE__ */ jsxs(
4655
+ "div",
4656
+ {
4657
+ className: cn(
4658
+ "flex flex-col items-center justify-center text-muted-foreground",
4659
+ caption ? "gap-1" : "gap-0"
4660
+ ),
4661
+ children: [
4662
+ /* @__PURE__ */ jsx(
4663
+ User,
4664
+ {
4665
+ className: "h-1/2 w-1/2 max-h-[55%] max-w-[55%] shrink-0",
4666
+ "aria-hidden": true
4667
+ }
4668
+ ),
4669
+ caption ? /* @__PURE__ */ jsx("span", { className: "text-xs text-center px-1", children: caption }) : null
4670
+ ]
4671
+ }
4672
+ )
4635
4673
  }
4636
4674
  ),
4637
4675
  /* @__PURE__ */ jsx(
@@ -4728,7 +4766,7 @@ function AvatarEditorDialog({
4728
4766
  /* @__PURE__ */ jsx(Dialog, { open: isOpen, onOpenChange: handleOpenChange, children: /* @__PURE__ */ jsxs(DialogContent, { className: "sm:max-w-md", children: [
4729
4767
  /* @__PURE__ */ jsx(DialogHeader, { children: /* @__PURE__ */ jsx(DialogTitle, { children: dialogTitle }) }),
4730
4768
  /* @__PURE__ */ jsx("div", { className: "flex justify-center py-4", children: EditorContent }),
4731
- /* @__PURE__ */ jsx(DialogFooter, { className: "gap-2 sm:gap-0", children: FooterButtons })
4769
+ /* @__PURE__ */ jsx(DialogFooter, { className: "sm:gap-3", children: FooterButtons })
4732
4770
  ] }) })
4733
4771
  ] });
4734
4772
  }