@pollinations/ui 0.1.0-alpha.11 → 0.1.0-alpha.12

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,5 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
- import { ReactNode } from 'react';
2
+ import { ReactNode, Ref } from 'react';
3
3
  import { D as DialogProps } from '../Dialog-D3Nqt8cE.cjs';
4
4
  import { B as ButtonProps } from '../Button-BGqClaBr.cjs';
5
5
  import '@ark-ui/react/dialog';
@@ -56,7 +56,7 @@ declare function ErrorBanner({ children }: {
56
56
  children: ReactNode;
57
57
  }): react_jsx_runtime.JSX.Element;
58
58
  type AuthInfoCardProps = {
59
- title?: string | null;
59
+ title?: ReactNode;
60
60
  children: ReactNode;
61
61
  };
62
62
  declare function AuthInfoCard({ title, children }: AuthInfoCardProps): react_jsx_runtime.JSX.Element;
@@ -65,7 +65,7 @@ declare function AuthInfoCard({ title, children }: AuthInfoCardProps): react_jsx
65
65
  * checkbox; a required row passes an `icon` instead, which takes the
66
66
  * checkbox slot so the rows line up.
67
67
  */
68
- declare function AuthAccessItem({ children, control, details, info, icon, checked, onChange, ariaLabel, disabled, }: {
68
+ declare function AuthAccessItem({ children, control, details, info, icon, checked, onChange, ariaLabel, disabled, inputRef, rowClassName, }: {
69
69
  children: ReactNode;
70
70
  control?: ReactNode;
71
71
  details?: ReactNode;
@@ -77,6 +77,8 @@ declare function AuthAccessItem({ children, control, details, info, icon, checke
77
77
  onChange?: (checked: boolean) => void;
78
78
  ariaLabel?: string;
79
79
  disabled?: boolean;
80
+ inputRef?: Ref<HTMLInputElement>;
81
+ rowClassName?: string;
80
82
  }): react_jsx_runtime.JSX.Element;
81
83
 
82
84
  declare function DashboardAccountMenu({ user, onSignOut, className, side, }: {
@@ -1,5 +1,5 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
- import { ReactNode } from 'react';
2
+ import { ReactNode, Ref } from 'react';
3
3
  import { D as DialogProps } from '../Dialog-D3Nqt8cE.js';
4
4
  import { B as ButtonProps } from '../Button-BGqClaBr.js';
5
5
  import '@ark-ui/react/dialog';
@@ -56,7 +56,7 @@ declare function ErrorBanner({ children }: {
56
56
  children: ReactNode;
57
57
  }): react_jsx_runtime.JSX.Element;
58
58
  type AuthInfoCardProps = {
59
- title?: string | null;
59
+ title?: ReactNode;
60
60
  children: ReactNode;
61
61
  };
62
62
  declare function AuthInfoCard({ title, children }: AuthInfoCardProps): react_jsx_runtime.JSX.Element;
@@ -65,7 +65,7 @@ declare function AuthInfoCard({ title, children }: AuthInfoCardProps): react_jsx
65
65
  * checkbox; a required row passes an `icon` instead, which takes the
66
66
  * checkbox slot so the rows line up.
67
67
  */
68
- declare function AuthAccessItem({ children, control, details, info, icon, checked, onChange, ariaLabel, disabled, }: {
68
+ declare function AuthAccessItem({ children, control, details, info, icon, checked, onChange, ariaLabel, disabled, inputRef, rowClassName, }: {
69
69
  children: ReactNode;
70
70
  control?: ReactNode;
71
71
  details?: ReactNode;
@@ -77,6 +77,8 @@ declare function AuthAccessItem({ children, control, details, info, icon, checke
77
77
  onChange?: (checked: boolean) => void;
78
78
  ariaLabel?: string;
79
79
  disabled?: boolean;
80
+ inputRef?: Ref<HTMLInputElement>;
81
+ rowClassName?: string;
80
82
  }): react_jsx_runtime.JSX.Element;
81
83
 
82
84
  declare function DashboardAccountMenu({ user, onSignOut, className, side, }: {
@@ -743,7 +743,7 @@ function ErrorBanner({ children }) {
743
743
  }
744
744
  function AuthInfoCard({ title, children }) {
745
745
  return /* @__PURE__ */ jsxs6(Surface, { className: "polli:space-y-3 polli:font-body", children: [
746
- title != null && /* @__PURE__ */ jsx10("p", { className: "polli:font-body polli:text-sm polli:font-semibold polli:leading-5 polli:text-theme-text-strong", children: title }),
746
+ title != null && /* @__PURE__ */ jsx10("p", { className: "polli:flex polli:items-center polli:font-body polli:text-xs polli:font-medium polli:leading-5 polli:text-theme-text-muted", children: title }),
747
747
  children
748
748
  ] });
749
749
  }
@@ -756,36 +756,47 @@ function AuthAccessItem({
756
756
  checked = false,
757
757
  onChange,
758
758
  ariaLabel,
759
- disabled = false
759
+ disabled = false,
760
+ inputRef,
761
+ rowClassName
760
762
  }) {
761
- const Row = icon != null ? "div" : "label";
762
- return /* @__PURE__ */ jsxs6(
763
- "li",
764
- {
765
- className: cn(
766
- info != null && "polli:flex polli:flex-wrap polli:items-center"
767
- ),
768
- children: [
769
- /* @__PURE__ */ jsxs6(
770
- Row,
771
- {
772
- className: cn(
773
- "polli:flex polli:min-h-8 polli:items-center polli:gap-3 polli:font-body polli:text-sm polli:font-semibold polli:leading-5",
774
- info != null && "polli:min-w-0",
775
- onChange && (disabled ? "polli:cursor-not-allowed" : "polli:cursor-pointer")
776
- ),
777
- children: [
778
- icon != null ? /* @__PURE__ */ jsx10(
779
- "span",
780
- {
781
- "aria-hidden": "true",
782
- className: "polli:flex polli:h-5 polli:w-5 polli:shrink-0 polli:items-center polli:justify-center polli:text-theme-text-strong polli:[&>svg]:h-4 polli:[&>svg]:w-4",
783
- children: icon
784
- }
785
- ) : /* @__PURE__ */ jsxs6("span", { className: "polli:relative polli:flex polli:h-5 polli:w-5 polli:shrink-0", children: [
763
+ const inputId = useId();
764
+ const Row = icon != null || info != null ? "div" : "label";
765
+ const CheckboxLabel = info != null ? "label" : "span";
766
+ const Label = icon == null && info != null ? "label" : "span";
767
+ return /* @__PURE__ */ jsxs6("li", { children: [
768
+ /* @__PURE__ */ jsxs6(
769
+ Row,
770
+ {
771
+ className: cn(
772
+ "polli:flex polli:min-h-8 polli:items-center polli:font-body polli:text-sm polli:font-semibold polli:leading-5",
773
+ info != null && icon == null ? "polli:gap-0" : "polli:gap-3",
774
+ info != null && "polli:min-w-0",
775
+ onChange && Row === "label" && (disabled ? "polli:cursor-not-allowed" : "polli:cursor-pointer"),
776
+ rowClassName
777
+ ),
778
+ children: [
779
+ icon != null ? /* @__PURE__ */ jsx10(
780
+ "span",
781
+ {
782
+ "aria-hidden": "true",
783
+ className: "polli:flex polli:h-5 polli:w-5 polli:shrink-0 polli:items-center polli:justify-center polli:text-theme-text-strong polli:[&>svg]:h-4 polli:[&>svg]:w-4",
784
+ children: icon
785
+ }
786
+ ) : /* @__PURE__ */ jsxs6(
787
+ CheckboxLabel,
788
+ {
789
+ className: cn(
790
+ "polli:relative polli:flex polli:h-5 polli:shrink-0",
791
+ info != null ? "polli:w-8 polli:pr-3" : "polli:w-5",
792
+ onChange && (disabled ? "polli:cursor-not-allowed" : "polli:cursor-pointer")
793
+ ),
794
+ children: [
786
795
  /* @__PURE__ */ jsx10(
787
796
  "input",
788
797
  {
798
+ ref: inputRef,
799
+ id: inputId,
789
800
  type: "checkbox",
790
801
  "aria-label": ariaLabel,
791
802
  checked,
@@ -802,35 +813,30 @@ function AuthAccessItem({
802
813
  children: checked && /* @__PURE__ */ jsx10(CheckIcon, { className: "polli:h-3.5 polli:w-3.5" })
803
814
  }
804
815
  )
805
- ] }),
806
- /* @__PURE__ */ jsx10(
807
- "span",
808
- {
809
- className: cn(
810
- "polli:min-w-0 polli:flex-1 polli:transition-opacity",
811
- !!onChange && !checked && "polli:opacity-60"
812
- ),
813
- children
814
- }
815
- ),
816
- control != null && /* @__PURE__ */ jsx10("span", { className: "polli:shrink-0", children: control })
817
- ]
818
- }
819
- ),
820
- info,
821
- details && /* @__PURE__ */ jsx10(
822
- "div",
823
- {
824
- className: cn(
825
- "polli:pl-8 polli:font-body polli:text-xs polli:font-normal polli:leading-normal polli:text-theme-text-muted",
826
- info != null && "polli:basis-full"
816
+ ]
817
+ }
818
+ ),
819
+ /* @__PURE__ */ jsxs6("span", { className: "polli:min-w-0 polli:flex-1", children: [
820
+ /* @__PURE__ */ jsx10(
821
+ Label,
822
+ {
823
+ htmlFor: Label === "label" ? inputId : void 0,
824
+ className: cn(
825
+ "polli:transition-opacity",
826
+ !!onChange && !checked && "polli:opacity-60",
827
+ onChange && (disabled ? "polli:cursor-not-allowed" : "polli:cursor-pointer")
828
+ ),
829
+ children
830
+ }
827
831
  ),
828
- children: details
829
- }
830
- )
831
- ]
832
- }
833
- );
832
+ info
833
+ ] }),
834
+ control != null && /* @__PURE__ */ jsx10("span", { className: "polli:shrink-0", children: control })
835
+ ]
836
+ }
837
+ ),
838
+ details && /* @__PURE__ */ jsx10("div", { className: "polli:pl-8 polli:font-body polli:text-xs polli:font-normal polli:leading-normal polli:text-theme-text-muted", children: details })
839
+ ] });
834
840
  }
835
841
 
836
842
  // src/modules/auth/DashboardAccountMenu.tsx